servo: add a rather silly second test

Source-Repo: https://github.com/servo/servo
Source-Revision: 4a9f4c410eb59355c333ffc46717a2883bcf127b
This commit is contained in:
Niko Matsakis 2012-03-27 16:26:12 -07:00
parent b98c0e9eff
commit 448e69cc86

View File

@ -77,8 +77,7 @@ mod test {
dummy(@{fields: empty(), value: v})
}
#[test]
fn add_child_0() {
fn parent_with_3_children() -> {p: dummy, children: [dummy]} {
let children = [new_dummy(0u),
new_dummy(1u),
new_dummy(2u)];
@ -88,6 +87,12 @@ mod test {
add_child(p, c);
}
ret {p: p, children: children};
}
#[test]
fn add_child_0() {
let {p, children} = parent_with_3_children();
let mut i = 0u;
for each_child(p) {|c|
assert c.value == i;
@ -95,4 +100,15 @@ mod test {
}
assert i == children.len();
}
#[test]
fn add_child_break() {
let {p, _} = parent_with_3_children();
let mut i = 0u;
for each_child(p) {|_c|
i += 1u;
break;
}
assert i == 1u;
}
}