Skip to content

Commit e7bf5da

Browse files
committed
---
yaml --- r: 30584 b: refs/heads/incoming c: efa6675 h: refs/heads/master v: v3
1 parent 1f56ef8 commit e7bf5da

File tree

6 files changed

+38
-14
lines changed

6 files changed

+38
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: 3b013cd800ce675a445220105911bbefd2427e47
9+
refs/heads/incoming: efa6675f1d632f5d524f4a7a18838c6ee1c0c447
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/cargo/cargo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ fn install_source(c: cargo, path: &Path) {
804804

805805
let mut cratefiles = ~[];
806806
for os::walk_dir(&Path(".")) |p| {
807-
if p.filetype() == Some(~"rc") {
807+
if p.filetype() == Some(~".rc") {
808808
vec::push(cratefiles, *p);
809809
}
810810
}

branches/incoming/src/fuzzer/fuzzer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fn contains(haystack: ~str, needle: ~str) -> bool {
2626
}
2727

2828
fn find_rust_files(files: &mut ~[Path], path: &Path) {
29-
if path.filetype() == Some(~"rs") && !contains(path.to_str(), ~"utf8") {
29+
if path.filetype() == Some(~".rs") && !contains(path.to_str(), ~"utf8") {
3030
// ignoring "utf8" tests because something is broken
3131
vec::push(*files, *path);
3232
} else if os::path_is_dir(path)

branches/incoming/src/libcore/path.rs

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl PosixPath : GenericPath {
128128
None => None,
129129
Some(ref f) => {
130130
match str::rfind_char(*f, '.') {
131-
Some(p) if p+1 < f.len() => Some(f.slice(p+1, f.len())),
131+
Some(p) if p < f.len() => Some(f.slice(p, f.len())),
132132
_ => None
133133
}
134134
}
@@ -153,8 +153,7 @@ impl PosixPath : GenericPath {
153153
pure fn with_filestem(s: &str) -> PosixPath {
154154
match self.filetype() {
155155
None => self.with_filename(s),
156-
Some(ref t) =>
157-
self.with_filename(str::from_slice(s) + "." + *t)
156+
Some(ref t) => self.with_filename(str::from_slice(s) + *t)
158157
}
159158
}
160159

@@ -168,8 +167,7 @@ impl PosixPath : GenericPath {
168167
let t = ~"." + str::from_slice(t);
169168
match self.filestem() {
170169
None => self.with_filename(t),
171-
Some(ref s) =>
172-
self.with_filename(*s + t)
170+
Some(ref s) => self.with_filename(*s + t)
173171
}
174172
}
175173
}
@@ -321,7 +319,7 @@ impl WindowsPath : GenericPath {
321319
None => None,
322320
Some(ref f) => {
323321
match str::rfind_char(*f, '.') {
324-
Some(p) if p+1 < f.len() => Some(f.slice(p+1, f.len())),
322+
Some(p) if p < f.len() => Some(f.slice(p, f.len())),
325323
_ => None
326324
}
327325
}
@@ -344,8 +342,7 @@ impl WindowsPath : GenericPath {
344342
pure fn with_filestem(s: &str) -> WindowsPath {
345343
match self.filetype() {
346344
None => self.with_filename(s),
347-
Some(ref t) =>
348-
self.with_filename(str::from_slice(s) + "." + *t)
345+
Some(ref t) => self.with_filename(str::from_slice(s) + *t)
349346
}
350347
}
351348

@@ -470,6 +467,18 @@ mod posix {
470467
}
471468
}
472469

470+
#[test]
471+
fn test_filetype_foo_bar() {
472+
let wp = mk("foo.bar");
473+
assert wp.filetype() == Some(~".bar");
474+
}
475+
476+
#[test]
477+
fn test_filetype_foo() {
478+
let wp = mk("foo");
479+
assert wp.filetype() == None;
480+
}
481+
473482
#[test]
474483
fn test_posix_paths() {
475484
t(&(mk("hi")), "hi");
@@ -642,4 +651,19 @@ mod windows {
642651

643652
}
644653

654+
#[cfg(test)]
655+
fn mk(s: &str) -> PosixPath { from_str::<PosixPath>(s) }
656+
657+
#[test]
658+
fn test_filetype_foo_bar() {
659+
let wp = mk("foo.bar");
660+
assert wp.filetype() == Some(~".bar");
661+
}
662+
663+
#[test]
664+
fn test_filetype_foo() {
665+
let wp = mk("foo");
666+
assert wp.filetype() == None;
667+
}
668+
645669
}

branches/incoming/src/libsyntax/parse.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ fn new_parse_sess_special_handler(sh: span_handler, cm: codemap::codemap)
5151

5252
fn parse_crate_from_file(input: &Path, cfg: ast::crate_cfg,
5353
sess: parse_sess) -> @ast::crate {
54-
if input.filetype() == Some(~"rc") {
54+
if input.filetype() == Some(~".rc") {
5555
parse_crate_from_crate_file(input, cfg, sess)
56-
} else if input.filetype() == Some(~"rs") {
56+
} else if input.filetype() == Some(~".rs") {
5757
parse_crate_from_source_file(input, cfg, sess)
5858
} else {
5959
sess.span_diagnostic.handler().fatal(~"unknown input file type: " +

branches/incoming/src/rustc/back/linkage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ fn link_binary(sess: session,
685685

686686
let cstore = sess.cstore;
687687
for cstore::get_used_crate_files(cstore).each |cratepath| {
688-
if cratepath.filetype() == Some(~"rlib") {
688+
if cratepath.filetype() == Some(~".rlib") {
689689
vec::push(cc_args, cratepath.to_str());
690690
loop;
691691
}

0 commit comments

Comments
 (0)