OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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"; | 5 import "package:expect/expect.dart"; |
6 | 6 |
7 // Testing method invocation. | 7 // Testing method invocation. |
8 // Currently testing only NoSuchMethodError. | 8 // Currently testing only NoSuchMethodError. |
9 | 9 |
10 class A { | 10 class A { |
11 A() {} | 11 A() {} |
12 int foo() { | 12 int foo() { |
13 return 1; | 13 return 1; |
14 } | 14 } |
15 } | 15 } |
16 | 16 |
17 class B { | 17 class B { |
18 get f { throw 123; } | 18 get f { |
| 19 throw 123; |
| 20 } |
19 } | 21 } |
20 | 22 |
21 class MethodInvocationTest { | 23 class MethodInvocationTest { |
22 static void testNullReceiver() { | 24 static void testNullReceiver() { |
23 A a = new A(); | 25 A a = new A(); |
24 Expect.equals(1, a.foo()); | 26 Expect.equals(1, a.foo()); |
25 a = null; | 27 a = null; |
26 bool exceptionCaught = false; | 28 bool exceptionCaught = false; |
27 try { | 29 try { |
28 a.foo(); | 30 a.foo(); |
(...skipping 14 matching lines...) Expand all Loading... |
43 | 45 |
44 static void testMain() { | 46 static void testMain() { |
45 testNullReceiver(); | 47 testNullReceiver(); |
46 testGetterMethodInvocation(); | 48 testGetterMethodInvocation(); |
47 } | 49 } |
48 } | 50 } |
49 | 51 |
50 main() { | 52 main() { |
51 MethodInvocationTest.testMain(); | 53 MethodInvocationTest.testMain(); |
52 } | 54 } |
OLD | NEW |