summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorLindsey Kuper <lkuper@mozilla.com>2011-07-20 15:46:56 -0700
committerLindsey Kuper <lkuper@mozilla.com>2011-07-20 15:49:33 -0700
commit431cb9a3454fe19fe6987aebb3b3655dc9eca8ad (patch)
tree6147b86c8c449b44d6fb302639ca10d67661996e /src/test
parent336949a5908c27759b3bce0bb6678860d63eb047 (diff)
downloadrust-431cb9a3454fe19fe6987aebb3b3655dc9eca8ad.tar.gz
rust-431cb9a3454fe19fe6987aebb3b3655dc9eca8ad.zip
Test method overriding a little more.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/anon-obj-overriding.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/run-pass/anon-obj-overriding.rs b/src/test/run-pass/anon-obj-overriding.rs
index 2e86f57ad2c..a075c6ea13d 100644
--- a/src/test/run-pass/anon-obj-overriding.rs
+++ b/src/test/run-pass/anon-obj-overriding.rs
@@ -26,4 +26,21 @@ fn main() {
 
     assert (my_b.foo() == 3);
     assert (my_b.bar() == 3);
+
+    auto my_c = obj() {
+        fn baz(int x, int y) -> int {
+            ret x + y + self.foo();
+        }
+        with my_b
+    };
+
+    auto my_d = obj() {
+        fn baz(int x, int y) -> int {
+            ret x + y + self.foo();
+        }
+        with my_a
+    };
+
+    assert (my_c.baz(1, 2) == 6);
+    assert (my_d.baz(1, 2) == 5);
 }