Fix tests

This commit is contained in:
Jorge Aparicio 2014-11-03 14:55:19 -05:00
parent 6216822249
commit 11f4baeafb
4 changed files with 19 additions and 19 deletions

View File

@ -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]

View File

@ -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]

View File

@ -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");
@ -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!(),
/// }
@ -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]
@ -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]
@ -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]
@ -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]

View File

@ -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 {