Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Aparicio committed Nov 6, 2014
1 parent 6216822 commit 11f4bae
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
10 changes: 5 additions & 5 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1598,15 +1598,15 @@ mod tests {
#[test]
fn test_total_ord() {
let c: &[int] = &[1, 2, 3];
[1, 2, 3, 4][].cmp(& c) == Greater;
[1, 2, 3, 4][].cmp(c) == Greater;
let c: &[int] = &[1, 2, 3, 4];
[1, 2, 3][].cmp(& c) == Less;
[1, 2, 3][].cmp(c) == Less;
let c: &[int] = &[1, 2, 3, 6];
[1, 2, 3, 4][].cmp(& c) == Equal;
[1, 2, 3, 4][].cmp(c) == Equal;
let c: &[int] = &[1, 2, 3, 4, 5, 6];
[1, 2, 3, 4, 5, 5, 5, 5][].cmp(& c) == Less;
[1, 2, 3, 4, 5, 5, 5, 5][].cmp(c) == Less;
let c: &[int] = &[1, 2, 3, 4];
[2, 2][].cmp(& c) == Greater;
[2, 2][].cmp(c) == Greater;
}

#[test]
Expand Down
10 changes: 5 additions & 5 deletions src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1530,11 +1530,11 @@ mod tests {

#[test]
fn test_total_ord() {
"1234".cmp(&("123")) == Greater;
"123".cmp(&("1234")) == Less;
"1234".cmp(&("1234")) == Equal;
"12345555".cmp(&("123456")) == Less;
"22".cmp(&("1234")) == Greater;
"1234".cmp("123") == Greater;
"123".cmp("1234") == Less;
"1234".cmp("1234") == Equal;
"12345555".cmp("123456") == Less;
"22".cmp("1234") == Greater;
}

#[test]
Expand Down
14 changes: 7 additions & 7 deletions src/libcollections/tree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ impl<K, V> TreeMap<K, V> {
/// let headers = get_headers();
/// let ua_key = "User-Agent";
/// let ua = headers.find_with(|k| {
/// ua_key.cmp(&k.as_slice())
/// ua_key.cmp(k.as_slice())
/// });
///
/// assert_eq!((*ua.unwrap()).as_slice(), "Curl-Rust/0.1");
Expand All @@ -603,7 +603,7 @@ impl<K, V> TreeMap<K, V> {
/// t.insert("User-Agent", "Curl-Rust/0.1");
///
/// let new_ua = "Safari/156.0";
/// match t.find_with_mut(|k| "User-Agent".cmp(k)) {
/// match t.find_with_mut(|&k| "User-Agent".cmp(k)) {
/// Some(x) => *x = new_ua,
/// None => panic!(),
/// }
Expand Down Expand Up @@ -1302,7 +1302,7 @@ mod test_treemap {
#[test]
fn find_with_empty() {
let m: TreeMap<&'static str,int> = TreeMap::new();
assert!(m.find_with(|k| "test".cmp(k)) == None);
assert!(m.find_with(|&k| "test".cmp(k)) == None);
}

#[test]
Expand All @@ -1311,7 +1311,7 @@ mod test_treemap {
assert!(m.insert("test1", 2i));
assert!(m.insert("test2", 3i));
assert!(m.insert("test3", 3i));
assert_eq!(m.find_with(|k| "test4".cmp(k)), None);
assert_eq!(m.find_with(|&k| "test4".cmp(k)), None);
}

#[test]
Expand All @@ -1320,7 +1320,7 @@ mod test_treemap {
assert!(m.insert("test1", 2i));
assert!(m.insert("test2", 3i));
assert!(m.insert("test3", 4i));
assert_eq!(m.find_with(|k| "test2".cmp(k)), Some(&3i));
assert_eq!(m.find_with(|&k| "test2".cmp(k)), Some(&3i));
}

#[test]
Expand All @@ -1343,10 +1343,10 @@ mod test_treemap {
assert!(m.insert("t2", 8));
assert!(m.insert("t5", 14));
let new = 100;
match m.find_with_mut(|k| "t5".cmp(k)) {
match m.find_with_mut(|&k| "t5".cmp(k)) {
None => panic!(), Some(x) => *x = new
}
assert_eq!(m.find_with(|k| "t5".cmp(k)), Some(&new));
assert_eq!(m.find_with(|&k| "t5".cmp(k)), Some(&new));
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions src/test/compile-fail/deriving-no-inner-impl-error-message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ struct NoCloneOrEq;

#[deriving(PartialEq)]
struct E {
x: NoCloneOrEq //~ ERROR does not implement any method in scope named `eq`
//~^ ERROR does not implement any method in scope named `ne`
x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to type `NoCloneOrEq`
//~^ ERROR binary operation `!=` cannot be applied to type `NoCloneOrEq`
}
#[deriving(Clone)]
struct C {
Expand Down

0 comments on commit 11f4bae

Please sign in to comment.