OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "package:expect/expect.dart"; | |
6 | |
7 main() { | 5 main() { |
8 var a = new A(); | 6 var a = new A(); |
9 Expect.equals(42, a.foo(42)); | 7 Expect.equals(42, a.foo(42)); |
10 var b = new B(); | 8 var b = new B(); |
11 Expect.equals(42 - 87, b.foo(42)); | 9 Expect.equals(42 - 87, b.foo(42)); |
12 | 10 |
13 // Make sure we do not try to track the parameter type of the | 11 // Make sure we do not try to track the parameter type of the |
14 // argument passed to test. | 12 // argument passed to test. |
15 Expect.equals("is !A", test(0)); | 13 Expect.equals("is !A", test(0)); |
16 Expect.equals("is !A", test("fisk")); | 14 Expect.equals("is !A", test("fisk")); |
(...skipping 16 matching lines...) Expand all Loading... |
33 } | 31 } |
34 } | 32 } |
35 | 33 |
36 class A { | 34 class A { |
37 foo(var x) => x; | 35 foo(var x) => x; |
38 } | 36 } |
39 | 37 |
40 class B implements A { | 38 class B implements A { |
41 foo(var x) => x - 87; | 39 foo(var x) => x - 87; |
42 } | 40 } |
OLD | NEW |