From 6157f1dc06179fa97d776b5c442307cae77e925d Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 7 Dec 2012 21:56:46 -0800 Subject: [PATCH] test: Fix some busted run-pass tests, fallout from the pattern bindings change. rs=bustage --- .../borrowck-preserve-box-in-discr.rs | 6 +++--- src/test/run-pass/monad.rs | 2 +- src/test/run-pass/size-and-align.rs | 2 +- src/test/run-pass/trait-cast.rs | 2 +- src/test/run-pass/while-prelude-drop.rs | 21 +------------------ 5 files changed, 7 insertions(+), 26 deletions(-) diff --git a/src/test/run-pass/borrowck-preserve-box-in-discr.rs b/src/test/run-pass/borrowck-preserve-box-in-discr.rs index 5ed78488b35..c65472ec894 100644 --- a/src/test/run-pass/borrowck-preserve-box-in-discr.rs +++ b/src/test/run-pass/borrowck-preserve-box-in-discr.rs @@ -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)); } } -} \ No newline at end of file +} diff --git a/src/test/run-pass/monad.rs b/src/test/run-pass/monad.rs index ddfc29fc8d8..af4be894f36 100644 --- a/src/test/run-pass/monad.rs +++ b/src/test/run-pass/monad.rs @@ -20,7 +20,7 @@ trait option_monad { impl Option: option_monad { fn bind(f: fn(A) -> Option) -> Option { match self { - Some(a) => { f(a) } + Some(ref a) => { f(*a) } None => { None } } } diff --git a/src/test/run-pass/size-and-align.rs b/src/test/run-pass/size-and-align.rs index 992be416598..b20e6efa858 100644 --- a/src/test/run-pass/size-and-align.rs +++ b/src/test/run-pass/size-and-align.rs @@ -6,7 +6,7 @@ enum clam { a(T, int), b, } fn uhoh(v: ~[clam]) { match v[1] { - a::(t, u) => { debug!("incorrect"); log(debug, u); fail; } + a::(ref t, ref u) => { debug!("incorrect"); log(debug, u); fail; } b:: => { debug!("correct"); } } } diff --git a/src/test/run-pass/trait-cast.rs b/src/test/run-pass/trait-cast.rs index 5fe4d53497f..b307c6e7e7e 100644 --- a/src/test/run-pass/trait-cast.rs +++ b/src/test/run-pass/trait-cast.rs @@ -15,7 +15,7 @@ impl Option: to_str { fn to_str() -> ~str { match self { None => { ~"none" } - Some(t) => { ~"some(" + t.to_str() + ~")" } + Some(ref t) => { ~"some(" + t.to_str() + ~")" } } } } diff --git a/src/test/run-pass/while-prelude-drop.rs b/src/test/run-pass/while-prelude-drop.rs index f74d6725836..c8d9ea14d54 100644 --- a/src/test/run-pass/while-prelude-drop.rs +++ b/src/test/run-pass/while-prelude-drop.rs @@ -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";