Skip to content

Commit f644e9e

Browse files
committed
---
yaml --- r: 62932 b: refs/heads/snap-stage3 c: c5d7a77 h: refs/heads/master v: v3
1 parent d2c432f commit f644e9e

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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 871684376f504dc58b53f5d5cd55ccb7d7f4b2ea
4+
refs/heads/snap-stage3: c5d7a77a533d33a4681f629744f0d0695c5e08b7
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/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/snap-stage3/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)