rust/src/test/run-pass/class-exports.rs
Tim Chevalier e0da0dd446 Test for issue 2286
which is really kind of a non-issue because class methods aren't
items that can be selectively imported/exported anyhow, unlike enum
variants. But, might as well have a test.
2012-05-02 14:02:44 -07:00

19 lines
358 B
Rust

/* Test that exporting a class also exports its
public fields and methods */
import kitty::*;
mod kitty {
export cat;
class cat {
let meows: uint;
let name: str;
fn get_name() -> str { self.name }
new(in_name: str) { self.name = in_name; self.meows = 0u; }
}
}
fn main() {
assert(cat("Spreckles").get_name() == "Spreckles");
}