Add another test for cross-crate method calls

This commit is contained in:
Tim Chevalier 2012-03-23 21:43:10 -07:00
parent 6b84cee5d3
commit bebdfe8ce8
2 changed files with 30 additions and 0 deletions

View 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 }
}
}

View 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);
}