rust/src/test/run-pass/standalone-method.rs
Brian Anderson 518dc52f85 Reformat
This changes the indexing syntax from .() to [], the vector syntax from ~[] to
[] and the extension syntax from #fmt() to #fmt[]
2011-08-20 11:04:00 -07:00

19 lines
391 B
Rust

// Test case for issue #435.
obj foo() {
fn add5(n: int) -> int { ret n + 5; }
}
fn add5(n: int) -> int { ret n + 5; }
fn main() {
let fiveplusseven = bind add5(7);
assert (add5(7) == 12);
assert (fiveplusseven() == 12);
let my_foo = foo();
let fiveplusseven_too = bind my_foo.add5(7);
assert (my_foo.add5(7) == 12);
assert (fiveplusseven_too() == 12);
}