From c15871ac517136e216a1783d722307a1da1da106 Mon Sep 17 00:00:00 2001 From: Lindsey Kuper Date: Thu, 28 Jul 2011 10:37:11 -0700 Subject: [PATCH] Test case for issue #435. --- src/test/run-pass/standalone-method.rs | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/test/run-pass/standalone-method.rs diff --git a/src/test/run-pass/standalone-method.rs b/src/test/run-pass/standalone-method.rs new file mode 100644 index 000000000000..f23bf2d04a84 --- /dev/null +++ b/src/test/run-pass/standalone-method.rs @@ -0,0 +1,27 @@ +//xfail-stage0 +//xfail-stage1 +//xfail-stage2 +//xfail-stage3 + +// 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; +} +