Fix tests
This commit is contained in:
parent
6216822249
commit
11f4baeafb
4 changed files with 19 additions and 19 deletions
|
@ -1598,15 +1598,15 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_total_ord() {
|
fn test_total_ord() {
|
||||||
let c: &[int] = &[1, 2, 3];
|
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];
|
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];
|
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];
|
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];
|
let c: &[int] = &[1, 2, 3, 4];
|
||||||
[2, 2][].cmp(& c) == Greater;
|
[2, 2][].cmp(c) == Greater;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -1530,11 +1530,11 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_total_ord() {
|
fn test_total_ord() {
|
||||||
"1234".cmp(&("123")) == Greater;
|
"1234".cmp("123") == Greater;
|
||||||
"123".cmp(&("1234")) == Less;
|
"123".cmp("1234") == Less;
|
||||||
"1234".cmp(&("1234")) == Equal;
|
"1234".cmp("1234") == Equal;
|
||||||
"12345555".cmp(&("123456")) == Less;
|
"12345555".cmp("123456") == Less;
|
||||||
"22".cmp(&("1234")) == Greater;
|
"22".cmp("1234") == Greater;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -579,7 +579,7 @@ impl<K, V> TreeMap<K, V> {
|
||||||
/// let headers = get_headers();
|
/// let headers = get_headers();
|
||||||
/// let ua_key = "User-Agent";
|
/// let ua_key = "User-Agent";
|
||||||
/// let ua = headers.find_with(|k| {
|
/// 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");
|
/// 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");
|
/// t.insert("User-Agent", "Curl-Rust/0.1");
|
||||||
///
|
///
|
||||||
/// let new_ua = "Safari/156.0";
|
/// 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,
|
/// Some(x) => *x = new_ua,
|
||||||
/// None => panic!(),
|
/// None => panic!(),
|
||||||
/// }
|
/// }
|
||||||
|
@ -1302,7 +1302,7 @@ mod test_treemap {
|
||||||
#[test]
|
#[test]
|
||||||
fn find_with_empty() {
|
fn find_with_empty() {
|
||||||
let m: TreeMap<&'static str,int> = TreeMap::new();
|
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]
|
#[test]
|
||||||
|
@ -1311,7 +1311,7 @@ mod test_treemap {
|
||||||
assert!(m.insert("test1", 2i));
|
assert!(m.insert("test1", 2i));
|
||||||
assert!(m.insert("test2", 3i));
|
assert!(m.insert("test2", 3i));
|
||||||
assert!(m.insert("test3", 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]
|
#[test]
|
||||||
|
@ -1320,7 +1320,7 @@ mod test_treemap {
|
||||||
assert!(m.insert("test1", 2i));
|
assert!(m.insert("test1", 2i));
|
||||||
assert!(m.insert("test2", 3i));
|
assert!(m.insert("test2", 3i));
|
||||||
assert!(m.insert("test3", 4i));
|
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]
|
#[test]
|
||||||
|
@ -1343,10 +1343,10 @@ mod test_treemap {
|
||||||
assert!(m.insert("t2", 8));
|
assert!(m.insert("t2", 8));
|
||||||
assert!(m.insert("t5", 14));
|
assert!(m.insert("t5", 14));
|
||||||
let new = 100;
|
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
|
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]
|
#[test]
|
||||||
|
|
|
@ -12,8 +12,8 @@ struct NoCloneOrEq;
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[deriving(PartialEq)]
|
||||||
struct E {
|
struct E {
|
||||||
x: NoCloneOrEq //~ ERROR does not implement any method in scope named `eq`
|
x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to type `NoCloneOrEq`
|
||||||
//~^ ERROR does not implement any method in scope named `ne`
|
//~^ ERROR binary operation `!=` cannot be applied to type `NoCloneOrEq`
|
||||||
}
|
}
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
struct C {
|
struct C {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue