Skip to content

Commit b5f3d34

Browse files
committed
---
yaml --- r: 60913 b: refs/heads/auto c: c5d7a77 h: refs/heads/master i: 60911: 602e45c v: v3
1 parent a8a1949 commit b5f3d34

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 871684376f504dc58b53f5d5cd55ccb7d7f4b2ea
17+
refs/heads/auto: c5d7a77a533d33a4681f629744f0d0695c5e08b7
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/libstd/run.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,34 +1100,28 @@ mod tests {
11001100
11011101
#[test]
11021102
fn test_keep_current_working_dir() {
1103+
11031104
let mut prog = run_pwd(None);
11041105
11051106
let output = str::from_bytes(prog.finish_with_output().output);
11061107
let parent_dir = os::getcwd().normalize();
11071108
let child_dir = Path(output.trim()).normalize();
11081109
1109-
let parent_stat = parent_dir.stat().unwrap();
1110-
let child_stat = child_dir.stat().unwrap();
1111-
1112-
assert_eq!(parent_stat.st_dev, child_stat.st_dev);
1113-
assert_eq!(parent_stat.st_ino, child_stat.st_ino);
1110+
assert_eq!(child_dir.to_str(), parent_dir.to_str());
11141111
}
11151112
11161113
#[test]
11171114
fn test_change_working_directory() {
1115+
11181116
// test changing to the parent of os::getcwd() because we know
11191117
// the path exists (and os::getcwd() is not expected to be root)
1120-
let parent_dir = os::getcwd().dir_path().normalize();
1121-
let mut prog = run_pwd(Some(&parent_dir));
1118+
let parent_path = os::getcwd().dir_path().normalize();
1119+
let mut prog = run_pwd(Some(&parent_path));
11221120
11231121
let output = str::from_bytes(prog.finish_with_output().output);
11241122
let child_dir = Path(output.trim()).normalize();
11251123
1126-
let parent_stat = parent_dir.stat().unwrap();
1127-
let child_stat = child_dir.stat().unwrap();
1128-
1129-
assert_eq!(parent_stat.st_dev, child_stat.st_dev);
1130-
assert_eq!(parent_stat.st_ino, child_stat.st_ino);
1124+
assert_eq!(child_dir.to_str(), parent_path.to_str());
11311125
}
11321126
11331127
#[cfg(unix)]

branches/auto/src/libstd/vec.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ pub fn each<'r,T>(v: &'r [T], f: &fn(&'r T) -> bool) -> bool {
15321532
}
15331533
broke = n > 0;
15341534
}
1535-
return true;
1535+
return !broke;
15361536
}
15371537

15381538
/// Like `each()`, but for the case where you have
@@ -1554,7 +1554,7 @@ pub fn each_mut<'r,T>(v: &'r mut [T], f: &fn(elem: &'r mut T) -> bool) -> bool {
15541554
}
15551555
broke = n > 0;
15561556
}
1557-
return broke;
1557+
return !broke;
15581558
}
15591559

15601560
/// Like `each()`, but for the case where you have a vector that *may or may
@@ -3566,6 +3566,23 @@ mod tests {
35663566
}
35673567
}
35683568

3569+
#[test]
3570+
fn test_each_ret_len0() {
3571+
let mut a0 : [int, .. 0] = [];
3572+
assert_eq!(each(a0, |_p| fail!()), true);
3573+
assert_eq!(each_mut(a0, |_p| fail!()), true);
3574+
}
3575+
3576+
#[test]
3577+
fn test_each_ret_len1() {
3578+
let mut a1 = [17];
3579+
assert_eq!(each(a1, |_p| true), true);
3580+
assert_eq!(each_mut(a1, |_p| true), true);
3581+
assert_eq!(each(a1, |_p| false), false);
3582+
assert_eq!(each_mut(a1, |_p| false), false);
3583+
}
3584+
3585+
35693586
#[test]
35703587
fn test_each_permutation() {
35713588
let mut results: ~[~[int]];

0 commit comments

Comments
 (0)