Add another test for cross-crate method calls
This commit is contained in:
parent
6b84cee5d3
commit
bebdfe8ce8
17
src/test/auxiliary/cci_class_3.rs
Normal file
17
src/test/auxiliary/cci_class_3.rs
Normal file
@ -0,0 +1,17 @@
|
||||
mod kitties {
|
||||
|
||||
class cat {
|
||||
priv {
|
||||
let mutable meows : uint;
|
||||
}
|
||||
|
||||
let how_hungry : int;
|
||||
|
||||
new(in_x : uint, in_y : int) { meows = in_x; how_hungry = in_y; }
|
||||
|
||||
fn speak() { meows += 1u; }
|
||||
fn meow_count() -> uint { meows }
|
||||
|
||||
}
|
||||
|
||||
}
|
13
src/test/run-pass/class-methods-cross-crate.rs
Normal file
13
src/test/run-pass/class-methods-cross-crate.rs
Normal file
@ -0,0 +1,13 @@
|
||||
// xfail-fast
|
||||
// aux-build:cci_class_3.rs
|
||||
use cci_class_3;
|
||||
import cci_class_3::kitties::*;
|
||||
|
||||
fn main() {
|
||||
let nyan : cat = cat(52u, 99);
|
||||
let kitty = cat(1000u, 2);
|
||||
assert(nyan.how_hungry == 99);
|
||||
assert(kitty.how_hungry == 2);
|
||||
nyan.speak();
|
||||
assert(nyan.meow_count() == 53u);
|
||||
}
|
Loading…
Reference in New Issue
Block a user