From e9622f09aa0d8c70022f4bf3ea516d7349c2990c Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Thu, 23 Aug 2012 14:44:58 -0700 Subject: [PATCH] Remove match check from test cases --- src/test/bench/task-perf-one-million.rs | 15 ++++++++++----- src/test/compile-fail/alt-range-fail-dominate.rs | 15 ++++++++++----- .../borrowck-no-cycle-in-exchange-heap.rs | 3 ++- src/test/compile-fail/liveness-missing-ret2.rs | 2 +- src/test/pretty/block-disambig.rs | 11 ++++++----- src/test/pretty/unary-op-disambig.rs | 4 ++-- src/test/run-fail/alt-wildcards.rs | 3 ++- src/test/run-fail/unwind-alt.rs | 5 +++-- src/test/run-pass/alt-bot-2.rs | 2 +- src/test/run-pass/alt-pattern-lit.rs | 3 ++- src/test/run-pass/alt-range.rs | 3 ++- src/test/run-pass/alt-str.rs | 6 +++--- src/test/run-pass/binary-minus-without-space.rs | 2 +- src/test/run-pass/expr-alt-box.rs | 5 +++-- src/test/run-pass/expr-alt-generic-box1.rs | 2 +- src/test/run-pass/expr-alt-generic-box2.rs | 2 +- src/test/run-pass/expr-alt-generic-unique1.rs | 2 +- src/test/run-pass/expr-alt-generic-unique2.rs | 2 +- src/test/run-pass/expr-alt-generic.rs | 2 +- src/test/run-pass/expr-alt-struct.rs | 2 +- src/test/run-pass/expr-alt-unique.rs | 2 +- src/test/run-pass/weird-exprs.rs | 3 ++- 22 files changed, 57 insertions(+), 39 deletions(-) diff --git a/src/test/bench/task-perf-one-million.rs b/src/test/bench/task-perf-one-million.rs index 7473132940a..a9604c7c533 100644 --- a/src/test/bench/task-perf-one-million.rs +++ b/src/test/bench/task-perf-one-million.rs @@ -19,26 +19,29 @@ fn calc(children: uint, parent_ch: comm::Chan) { } for iter::repeat (children) { - match check comm::recv(port) { + match comm::recv(port) { ready(child_ch) => { vec::push(child_chs, child_ch); } + _ => fail ~"task-perf-one-million failed (port not ready)" } } comm::send(parent_ch, ready(chan)); - match check comm::recv(port) { + match comm::recv(port) { start => { do vec::iter (child_chs) |child_ch| { comm::send(child_ch, start); } } + _ => fail ~"task-perf-one-million failed (port not in start state)" } for iter::repeat (children) { - match check comm::recv(port) { + match comm::recv(port) { done(child_sum) => { sum += child_sum; } + _ => fail ~"task-perf-one-million failed (port not done)" } } @@ -60,13 +63,15 @@ fn main(args: ~[~str]) { do task::spawn { calc(children, chan); }; - match check comm::recv(port) { + match comm::recv(port) { ready(chan) => { comm::send(chan, start); } + _ => fail ~"task-perf-one-million failed (port not ready)" } - let sum = match check comm::recv(port) { + let sum = match comm::recv(port) { done(sum) => { sum } + _ => fail ~"task-perf-one-million failed (port not done)" }; error!("How many tasks? %d tasks.", sum); } diff --git a/src/test/compile-fail/alt-range-fail-dominate.rs b/src/test/compile-fail/alt-range-fail-dominate.rs index f58d0865265..eff18df2a0e 100644 --- a/src/test/compile-fail/alt-range-fail-dominate.rs +++ b/src/test/compile-fail/alt-range-fail-dominate.rs @@ -5,28 +5,33 @@ //error-pattern: unreachable fn main() { - match check 5u { + match 5u { 1u to 10u => { } 5u to 6u => { } + _ => {} }; - match check 5u { + match 5u { 3u to 6u => { } 4u to 6u => { } + _ => {} }; - match check 5u { + match 5u { 4u to 6u => { } 4u to 6u => { } + _ => {} }; - match check 'c' { + match 'c' { 'A' to 'z' => {} 'a' to 'z' => {} + _ => {} }; - match check 1.0 { + match 1.0 { 0.01 to 6.5 => {} 0.02 => {} + _ => {} }; } \ No newline at end of file diff --git a/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs b/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs index 8655ea0ab70..beab4d3409e 100644 --- a/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs +++ b/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs @@ -5,9 +5,10 @@ enum cycle { fn main() { let x = ~node({mut a: ~empty}); // Create a cycle! - match check *x { //~ NOTE loan of immutable local variable granted here + match *x { //~ NOTE loan of immutable local variable granted here node(ref y) => { y.a <- x; //~ ERROR moving out of immutable local variable prohibited due to outstanding loan } + empty => {} }; } diff --git a/src/test/compile-fail/liveness-missing-ret2.rs b/src/test/compile-fail/liveness-missing-ret2.rs index 5f488c4dc5a..932372c2c0b 100644 --- a/src/test/compile-fail/liveness-missing-ret2.rs +++ b/src/test/compile-fail/liveness-missing-ret2.rs @@ -3,7 +3,7 @@ fn f() -> int { // Make sure typestate doesn't interpreturn this match expression // as the function result - match check true { true => { } }; + match true { true => { } _ => {} }; } fn main() { } diff --git a/src/test/pretty/block-disambig.rs b/src/test/pretty/block-disambig.rs index 357a6d19fe4..2453ebf55c4 100644 --- a/src/test/pretty/block-disambig.rs +++ b/src/test/pretty/block-disambig.rs @@ -8,7 +8,7 @@ fn test2() -> int { let val = @0; { } *val } fn test3() { let regs = @{mut eax: 0}; - match check true { true => { } } + match true { true => { } _ => { } } (*regs).eax = 1; } @@ -20,14 +20,15 @@ fn test6() -> bool { { } (true || false) && true } fn test7() -> uint { let regs = @0; - match check true { true => { } } + match true { true => { } _ => { } } (*regs < 2) as uint } fn test8() -> int { let val = @0; - match check true { + match true { true => { } + _ => { } } if *val < 1 { 0 @@ -36,11 +37,11 @@ fn test8() -> int { } } -fn test9() { let regs = @mut 0; match check true { true => { } } *regs += 1; } +fn test9() { let regs = @mut 0; match true { true => { } _ => { } } *regs += 1; } fn test10() -> int { let regs = @mut ~[0]; - match check true { true => { } } + match true { true => { } _ => { } } (*regs)[0] } diff --git a/src/test/pretty/unary-op-disambig.rs b/src/test/pretty/unary-op-disambig.rs index 1e2c95fa325..ec79341576c 100644 --- a/src/test/pretty/unary-op-disambig.rs +++ b/src/test/pretty/unary-op-disambig.rs @@ -10,8 +10,8 @@ fn if_semi() -> int { if true { f() } else { f() }; -1 } fn if_nosemi() -> int { (if true { 0 } else { 0 }) - 1 } -fn alt_semi() -> int { match check true { true => { f() } }; -1 } +fn alt_semi() -> int { match true { true => { f() } _ => { } }; -1 } -fn alt_no_semi() -> int { (match check true { true => { 0 } }) - 1 } +fn alt_no_semi() -> int { (match true { true => { 0 } _ => { 1 } }) - 1 } fn stmt() { { f() }; -1; } diff --git a/src/test/run-fail/alt-wildcards.rs b/src/test/run-fail/alt-wildcards.rs index 39a381dd3ac..b8696bec083 100644 --- a/src/test/run-fail/alt-wildcards.rs +++ b/src/test/run-fail/alt-wildcards.rs @@ -1,8 +1,9 @@ // error-pattern:squirrelcupcake fn cmp() -> int { - match check (option::some('a'), option::none::) { + match (option::some('a'), option::none::) { (option::some(_), _) => { fail ~"squirrelcupcake"; } (_, option::some(_)) => { fail; } + _ => { fail ~"wat"; } } } diff --git a/src/test/run-fail/unwind-alt.rs b/src/test/run-fail/unwind-alt.rs index 579067927ca..3c09b01495f 100644 --- a/src/test/run-fail/unwind-alt.rs +++ b/src/test/run-fail/unwind-alt.rs @@ -4,8 +4,9 @@ fn test_box() { @0; } fn test_str() { - let res = match check false { true => { ~"happy" } }; - assert res == ~"happy"; + let res = match false { true => { ~"happy" }, + _ => fail ~"non-exhaustive match failure" }; + assert res == ~"happy"; } fn main() { test_box(); diff --git a/src/test/run-pass/alt-bot-2.rs b/src/test/run-pass/alt-bot-2.rs index 8b9f606d8d8..4e7493ce106 100644 --- a/src/test/run-pass/alt-bot-2.rs +++ b/src/test/run-pass/alt-bot-2.rs @@ -1,3 +1,3 @@ // n.b. This was only ever failing with optimization disabled. -fn a() -> int { match check return 1 { 2 => 3 } } +fn a() -> int { match return 1 { 2 => 3, _ => fail } } fn main() { a(); } diff --git a/src/test/run-pass/alt-pattern-lit.rs b/src/test/run-pass/alt-pattern-lit.rs index 8432077cd25..62ca1adb817 100644 --- a/src/test/run-pass/alt-pattern-lit.rs +++ b/src/test/run-pass/alt-pattern-lit.rs @@ -1,9 +1,10 @@ fn altlit(f: int) -> int { - match check f { + match f { 10 => { debug!("case 10"); return 20; } 11 => { debug!("case 11"); return 22; } + _ => fail ~"the impossible happened" } } diff --git a/src/test/run-pass/alt-range.rs b/src/test/run-pass/alt-range.rs index dff4f91be21..b80a6832583 100644 --- a/src/test/run-pass/alt-range.rs +++ b/src/test/run-pass/alt-range.rs @@ -7,9 +7,10 @@ fn main() { 6u..7u => fail ~"shouldn't match range", _ => {} } - match check 5u { + match 5u { 1u => fail ~"should match non-first range", 2u..6u => {} + _ => fail ~"math is broken" } match 'c' { 'a'..'z' => {} diff --git a/src/test/run-pass/alt-str.rs b/src/test/run-pass/alt-str.rs index 98754ecf0e2..03f49b8675a 100644 --- a/src/test/run-pass/alt-str.rs +++ b/src/test/run-pass/alt-str.rs @@ -1,7 +1,7 @@ // Issue #53 fn main() { - match check ~"test" { ~"not-test" => fail, ~"test" => (), _ => fail } + match ~"test" { ~"not-test" => fail, ~"test" => (), _ => fail } enum t { tag1(~str), tag2, } @@ -13,9 +13,9 @@ fn main() { _ => fail } - let x = match check ~"a" { ~"a" => 1, ~"b" => 2 }; + let x = match ~"a" { ~"a" => 1, ~"b" => 2, _ => fail }; assert (x == 1); - match check ~"a" { ~"a" => { } ~"b" => { } } + match ~"a" { ~"a" => { } ~"b" => { }, _ => fail } } diff --git a/src/test/run-pass/binary-minus-without-space.rs b/src/test/run-pass/binary-minus-without-space.rs index 86bdd52c6af..d77b276acc7 100644 --- a/src/test/run-pass/binary-minus-without-space.rs +++ b/src/test/run-pass/binary-minus-without-space.rs @@ -1,6 +1,6 @@ // Check that issue #954 stays fixed fn main() { - match check -1 { -1 => {} } + match -1 { -1 => {}, _ => fail ~"wat" } assert 1-1 == 0; } diff --git a/src/test/run-pass/expr-alt-box.rs b/src/test/run-pass/expr-alt-box.rs index eb49160ce6f..8fe7a4e4bc1 100644 --- a/src/test/run-pass/expr-alt-box.rs +++ b/src/test/run-pass/expr-alt-box.rs @@ -5,12 +5,13 @@ // Tests for match as expressions resulting in boxed types fn test_box() { - let res = match check true { true => { @100 } }; + let res = match true { true => { @100 } _ => fail ~"wat" }; assert (*res == 100); } fn test_str() { - let res = match check true { true => { ~"happy" } }; + let res = match true { true => { ~"happy" }, + _ => fail ~"not happy at all" }; assert (res == ~"happy"); } diff --git a/src/test/run-pass/expr-alt-generic-box1.rs b/src/test/run-pass/expr-alt-generic-box1.rs index 40121de92db..de6a66754b5 100644 --- a/src/test/run-pass/expr-alt-generic-box1.rs +++ b/src/test/run-pass/expr-alt-generic-box1.rs @@ -5,7 +5,7 @@ type compare = fn@(@T, @T) -> bool; fn test_generic(expected: @T, eq: compare) { - let actual: @T = match check true { true => { expected } }; + let actual: @T = match true { true => { expected }, _ => fail }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic-box2.rs b/src/test/run-pass/expr-alt-generic-box2.rs index 73c6a4b68b4..ad3436c2b8f 100644 --- a/src/test/run-pass/expr-alt-generic-box2.rs +++ b/src/test/run-pass/expr-alt-generic-box2.rs @@ -5,7 +5,7 @@ type compare = fn@(T, T) -> bool; fn test_generic(expected: T, eq: compare) { - let actual: T = match check true { true => { expected } }; + let actual: T = match true { true => { expected }, _ => fail ~"wat" }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic-unique1.rs b/src/test/run-pass/expr-alt-generic-unique1.rs index 420cb030134..a227931180f 100644 --- a/src/test/run-pass/expr-alt-generic-unique1.rs +++ b/src/test/run-pass/expr-alt-generic-unique1.rs @@ -4,7 +4,7 @@ type compare = fn@(~T, ~T) -> bool; fn test_generic(expected: ~T, eq: compare) { - let actual: ~T = match check true { true => { expected } }; + let actual: ~T = match true { true => { expected }, _ => fail ~"wat" }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic-unique2.rs b/src/test/run-pass/expr-alt-generic-unique2.rs index c425bedcef9..d92cde5d82a 100644 --- a/src/test/run-pass/expr-alt-generic-unique2.rs +++ b/src/test/run-pass/expr-alt-generic-unique2.rs @@ -5,7 +5,7 @@ type compare = fn@(T, T) -> bool; fn test_generic(expected: T, eq: compare) { - let actual: T = match check true { true => { expected } }; + let actual: T = match true { true => expected, _ => fail ~"wat" }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-generic.rs b/src/test/run-pass/expr-alt-generic.rs index 6f947402a13..8591e97e0ac 100644 --- a/src/test/run-pass/expr-alt-generic.rs +++ b/src/test/run-pass/expr-alt-generic.rs @@ -5,7 +5,7 @@ type compare = fn@(T, T) -> bool; fn test_generic(expected: T, eq: compare) { - let actual: T = match check true { true => { expected } }; + let actual: T = match true { true => { expected }, _ => fail ~"wat" }; assert (eq(expected, actual)); } diff --git a/src/test/run-pass/expr-alt-struct.rs b/src/test/run-pass/expr-alt-struct.rs index c0be37942a5..13f33255f4c 100644 --- a/src/test/run-pass/expr-alt-struct.rs +++ b/src/test/run-pass/expr-alt-struct.rs @@ -5,7 +5,7 @@ // Tests for match as expressions resulting in structural types fn test_rec() { - let rs = match check true { true => { {i: 100} } }; + let rs = match true { true => {i: 100}, _ => fail }; assert (rs == {i: 100}); } diff --git a/src/test/run-pass/expr-alt-unique.rs b/src/test/run-pass/expr-alt-unique.rs index 6e261899123..e20afdcc45d 100644 --- a/src/test/run-pass/expr-alt-unique.rs +++ b/src/test/run-pass/expr-alt-unique.rs @@ -5,7 +5,7 @@ // Tests for match as expressions resulting in boxed types fn test_box() { - let res = match check true { true => { ~100 } }; + let res = match true { true => { ~100 }, _ => fail }; assert (*res == 100); } diff --git a/src/test/run-pass/weird-exprs.rs b/src/test/run-pass/weird-exprs.rs index 7cb39115779..cd5d4594a41 100644 --- a/src/test/run-pass/weird-exprs.rs +++ b/src/test/run-pass/weird-exprs.rs @@ -59,7 +59,8 @@ fn canttouchthis() -> uint { fn angrydome() { loop { if break { } } let mut i = 0; - loop { i += 1; if i == 1 { match check again { 1 => { } } } break; } + loop { i += 1; if i == 1 { match again { 1 => { }, _ => fail ~"wat" } } + break; } } fn evil_lincoln() { let evil <- debug!("lincoln"); }