rust/src/test/run-pass/class-exports.rs
2012-09-07 14:02:33 -07:00

26 lines
404 B
Rust

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