From 431cb9a3454fe19fe6987aebb3b3655dc9eca8ad Mon Sep 17 00:00:00 2001 From: Lindsey Kuper Date: Wed, 20 Jul 2011 15:46:56 -0700 Subject: [PATCH] Test method overriding a little more. --- src/test/run-pass/anon-obj-overriding.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/test/run-pass/anon-obj-overriding.rs b/src/test/run-pass/anon-obj-overriding.rs index 2e86f57ad2c6..a075c6ea13d0 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); }