correct more broken tests

This commit is contained in:
Niko Matsakis 2012-03-24 22:15:34 -07:00
parent ac4294a176
commit 1d7d5c16b3
6 changed files with 20 additions and 12 deletions

View file

@ -1,7 +1,9 @@
// -*- rust -*-
// Tests that a function with a ! annotation always actually fails
// error-pattern: some control paths may return
fn bad_bang(i: uint) -> ! { ret 7u; }
fn bad_bang(i: uint) -> ! {
ret 7u;
//!^ ERROR expected `_|_` but found `uint` (types differ)
}
fn main() { bad_bang(5u); }

View file

@ -1,7 +1,9 @@
// -*- rust -*-
// Tests that a function with a ! annotation always actually fails
// error-pattern: may return to the caller
fn bad_bang(i: uint) -> ! { if i < 0u { } else { fail; } }
fn bad_bang(i: uint) -> ! {
if i < 0u { } else { fail; }
//!^ ERROR expected `_|_` but found `()` (types differ)
}
fn main() { bad_bang(5u); }

View file

@ -1,3 +1,4 @@
// error-pattern: some control paths may return
fn f() -> ! { 3 }
fn f() -> ! {
3 //! ERROR expected `_|_` but found `int` (types differ)
}
fn main() { }

View file

@ -1,4 +1,6 @@
// error-pattern:in non-returning function f, some control paths may return
fn g() -> ! { fail; }
fn f() -> ! { ret 42; g(); }
fn f() -> ! {
ret 42; //! ERROR expected `_|_` but found `int` (types differ)
g(); //! WARNING unreachable statement
}
fn main() { }

View file

@ -1,3 +1,5 @@
// error-pattern:in non-returning function f, some control paths may return
fn f() -> ! { ret 42; fail; }
fn f() -> ! {
ret 42; //! ERROR expected `_|_` but found `int` (types differ)
fail; //! WARNING unreachable statement
}
fn main() { }

View file

@ -1,11 +1,10 @@
// error-pattern:some control paths may return
/* Make sure a loop{} with a break in it can't be
the tailexpr in the body of a diverging function */
fn forever() -> ! {
loop {
break;
}
ret 42;
ret 42; //! ERROR expected `_|_` but found `int` (types differ)
}
fn main() {