Skip to content

Commit 431cb9a

Browse files
committed
Test method overriding a little more.
1 parent 336949a commit 431cb9a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/test/run-pass/anon-obj-overriding.rs

+17
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,21 @@ fn main() {
2626

2727
assert (my_b.foo() == 3);
2828
assert (my_b.bar() == 3);
29+
30+
auto my_c = obj() {
31+
fn baz(int x, int y) -> int {
32+
ret x + y + self.foo();
33+
}
34+
with my_b
35+
};
36+
37+
auto my_d = obj() {
38+
fn baz(int x, int y) -> int {
39+
ret x + y + self.foo();
40+
}
41+
with my_a
42+
};
43+
44+
assert (my_c.baz(1, 2) == 6);
45+
assert (my_d.baz(1, 2) == 5);
2946
}

0 commit comments

Comments
 (0)