Fix tests to avoid empty classes
This commit is contained in:
parent
feece9814a
commit
a5c9e8d59e
7 changed files with 18 additions and 12 deletions
|
@ -3,14 +3,15 @@
|
|||
// Test that a class with a non-copyable field can't be
|
||||
// copied
|
||||
class bar {
|
||||
new() {}
|
||||
let x: int;
|
||||
new(x:int) {self.x = x;}
|
||||
drop {}
|
||||
}
|
||||
|
||||
class foo {
|
||||
let i: int;
|
||||
let j: bar;
|
||||
new(i:int) { self.i = i; self.j = bar(); }
|
||||
new(i:int) { self.i = i; self.j = bar(5); }
|
||||
}
|
||||
|
||||
fn main() { let x <- foo(10); let y = x; log(error, x); }
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
enum an_enum/& { }
|
||||
iface an_iface/& { }
|
||||
class a_class/& { new() { } }
|
||||
class a_class/& { let x:int; new(x:int) { self.x = x; } }
|
||||
|
||||
fn a_fn1(e: an_enum/&a) -> an_enum/&b {
|
||||
ret e; //! ERROR mismatched types: expected `an_enum/&b` but found `an_enum/&a`
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// error-pattern: copying a noncopyable value
|
||||
|
||||
class r {
|
||||
new(_i:int) {}
|
||||
let i:int;
|
||||
new(i:int) {self.i = i;}
|
||||
drop {}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,8 @@ fn getbig_call_c_and_fail(i: int) {
|
|||
}
|
||||
|
||||
class and_then_get_big_again {
|
||||
new() {}
|
||||
let x:int;
|
||||
new(x:int) {self.x = x;}
|
||||
drop {
|
||||
fn getbig(i: int) {
|
||||
if i != 0 {
|
||||
|
@ -34,7 +35,7 @@ class and_then_get_big_again {
|
|||
|
||||
fn main() {
|
||||
task::spawn {||
|
||||
let r = and_then_get_big_again();
|
||||
let r = and_then_get_big_again(4);
|
||||
getbig_call_c_and_fail(10000);
|
||||
};
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
use std;
|
||||
|
||||
fn getbig_and_fail(&&i: int) {
|
||||
let _r = and_then_get_big_again();
|
||||
let _r = and_then_get_big_again(5);
|
||||
if i != 0 {
|
||||
getbig_and_fail(i - 1);
|
||||
} else {
|
||||
|
@ -14,7 +14,8 @@ fn getbig_and_fail(&&i: int) {
|
|||
}
|
||||
|
||||
class and_then_get_big_again {
|
||||
new() {}
|
||||
let x:int;
|
||||
new(x:int) {self.x = x;}
|
||||
drop {
|
||||
fn getbig(i: int) {
|
||||
if i != 0 {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use std;
|
||||
|
||||
fn getbig_and_fail(&&i: int) {
|
||||
let r = and_then_get_big_again();
|
||||
let r = and_then_get_big_again(5);
|
||||
if i != 0 {
|
||||
getbig_and_fail(i - 1);
|
||||
} else {
|
||||
|
@ -14,7 +14,8 @@ fn getbig_and_fail(&&i: int) {
|
|||
}
|
||||
|
||||
class and_then_get_big_again {
|
||||
new() {}
|
||||
let x:int;
|
||||
new(x:int) {self.x = x;}
|
||||
drop {}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
// error-pattern:whatever
|
||||
|
||||
class r {
|
||||
let x:int;
|
||||
// Setting the exit status after the runtime has already
|
||||
// failed has no effect and the process exits with the
|
||||
// runtime's exit code
|
||||
drop {
|
||||
os::set_exit_status(50);
|
||||
}
|
||||
new() {}
|
||||
new(x:int) {self.x = x;}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
log(error, "whatever");
|
||||
task::spawn {||
|
||||
let i = r();
|
||||
let i = r(5);
|
||||
};
|
||||
fail;
|
||||
}
|
Loading…
Reference in a new issue