test: Fix some busted run-pass tests, fallout from the pattern bindings change. rs=bustage

This commit is contained in:
Patrick Walton 2012-12-07 21:56:46 -08:00
parent e9e3d02b7d
commit 6157f1dc06
5 changed files with 7 additions and 26 deletions

View File

@ -2,8 +2,8 @@
fn main() {
let mut x = @{f: ~3};
match *x {
{f: b_x} => {
match x {
@{f: b_x} => {
assert *b_x == 3;
assert ptr::addr_of(&(*x.f)) == ptr::addr_of(&(*b_x));
@ -14,4 +14,4 @@ fn main() {
assert ptr::addr_of(&(*x.f)) != ptr::addr_of(&(*b_x));
}
}
}
}

View File

@ -20,7 +20,7 @@ trait option_monad<A> {
impl<A> Option<A>: option_monad<A> {
fn bind<B>(f: fn(A) -> Option<B>) -> Option<B> {
match self {
Some(a) => { f(a) }
Some(ref a) => { f(*a) }
None => { None }
}
}

View File

@ -6,7 +6,7 @@ enum clam<T> { a(T, int), b, }
fn uhoh<T>(v: ~[clam<T>]) {
match v[1] {
a::<T>(t, u) => { debug!("incorrect"); log(debug, u); fail; }
a::<T>(ref t, ref u) => { debug!("incorrect"); log(debug, u); fail; }
b::<T> => { debug!("correct"); }
}
}

View File

@ -15,7 +15,7 @@ impl <T: to_str> Option<T>: to_str {
fn to_str() -> ~str {
match self {
None => { ~"none" }
Some(t) => { ~"some(" + t.to_str() + ~")" }
Some(ref t) => { ~"some(" + t.to_str() + ~")" }
}
}
}

View File

@ -1,26 +1,7 @@
#[deriving_eq]
enum t { a, b(~str), }
impl t : cmp::Eq {
pure fn eq(&self, other: &t) -> bool {
match *self {
a => {
match (*other) {
a => true,
b(_) => false
}
}
b(s0) => {
match (*other) {
a => false,
b(s1) => s0 == s1
}
}
}
}
pure fn ne(&self, other: &t) -> bool { !(*self).eq(other) }
}
fn make(i: int) -> t {
if i > 10 { return a; }
let mut s = ~"hello";