Skip to content

Commit bebdfe8

Browse files
committed
Add another test for cross-crate method calls
1 parent 6b84cee commit bebdfe8

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/test/auxiliary/cci_class_3.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
mod kitties {
2+
3+
class cat {
4+
priv {
5+
let mutable meows : uint;
6+
}
7+
8+
let how_hungry : int;
9+
10+
new(in_x : uint, in_y : int) { meows = in_x; how_hungry = in_y; }
11+
12+
fn speak() { meows += 1u; }
13+
fn meow_count() -> uint { meows }
14+
15+
}
16+
17+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// xfail-fast
2+
// aux-build:cci_class_3.rs
3+
use cci_class_3;
4+
import cci_class_3::kitties::*;
5+
6+
fn main() {
7+
let nyan : cat = cat(52u, 99);
8+
let kitty = cat(1000u, 2);
9+
assert(nyan.how_hungry == 99);
10+
assert(kitty.how_hungry == 2);
11+
nyan.speak();
12+
assert(nyan.meow_count() == 53u);
13+
}

0 commit comments

Comments
 (0)