libstd: More test fixes
This commit is contained in:
parent
470a301467
commit
5c721bd810
@ -2,6 +2,8 @@
|
||||
#[forbid(deprecated_mode)];
|
||||
#[forbid(deprecated_pattern)];
|
||||
|
||||
use cmp::Eq;
|
||||
|
||||
/**
|
||||
* Miscellaneous helpers for common patterns.
|
||||
*/
|
||||
@ -62,7 +64,7 @@ mod tests {
|
||||
fn identity_crisis() {
|
||||
// Writing a test for the identity function. How did it come to this?
|
||||
let x = ~[(5, false)];
|
||||
assert x == id(copy x);
|
||||
assert x.eq(id(copy x));
|
||||
}
|
||||
#[test]
|
||||
fn test_swap() {
|
||||
|
@ -90,10 +90,33 @@ type Tm_ = {
|
||||
tm_nsec: i32, // nanoseconds
|
||||
};
|
||||
|
||||
impl Tm_ : Eq {
|
||||
pure fn eq(&&other: Tm_) -> bool {
|
||||
self.tm_sec == other.tm_sec &&
|
||||
self.tm_min == other.tm_min &&
|
||||
self.tm_hour == other.tm_hour &&
|
||||
self.tm_mday == other.tm_mday &&
|
||||
self.tm_mon == other.tm_mon &&
|
||||
self.tm_year == other.tm_year &&
|
||||
self.tm_wday == other.tm_wday &&
|
||||
self.tm_yday == other.tm_yday &&
|
||||
self.tm_isdst == other.tm_isdst &&
|
||||
self.tm_gmtoff == other.tm_gmtoff &&
|
||||
self.tm_zone == other.tm_zone &&
|
||||
self.tm_nsec == other.tm_nsec
|
||||
}
|
||||
}
|
||||
|
||||
enum Tm {
|
||||
Tm_(Tm_)
|
||||
}
|
||||
|
||||
impl Tm : Eq {
|
||||
pure fn eq(&&other: Tm) -> bool {
|
||||
*self == *other
|
||||
}
|
||||
}
|
||||
|
||||
fn empty_tm() -> Tm {
|
||||
Tm_({
|
||||
tm_sec: 0_i32,
|
||||
|
Loading…
x
Reference in New Issue
Block a user