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 // Dart test program for catch that we expect a class after an 'is'. 'aa' is a | 5 // Dart test program for catch that we expect a class after an 'is'. 'aa' is a |
6 // malformed type and a type error should be thrown upon test. | 6 // malformed type and a type error should be thrown upon test. |
7 | 7 |
8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
9 | 9 |
10 class A { | 10 class A { |
11 const A(); | 11 const A(); |
12 } | 12 } |
13 | 13 |
14 class IsNotClass2NegativeTest { | 14 class IsNotClass2NegativeTest { |
15 static testMain() { | 15 static testMain() { |
16 var a = new A(); | 16 var a = new A(); |
17 var aa = new A(); | 17 var aa = new A(); |
18 | 18 |
19 if (a is aa) { // static warning | 19 if (a is aa) { |
| 20 // static warning |
20 return 0; | 21 return 0; |
21 } | 22 } |
22 return 0; | 23 return 0; |
23 } | 24 } |
24 } | 25 } |
25 | 26 |
26 main() { | 27 main() { |
27 Expect.throws(IsNotClass2NegativeTest.testMain, (e) => e is TypeError); | 28 Expect.throws(IsNotClass2NegativeTest.testMain, (e) => e is TypeError); |
28 } | 29 } |
OLD | NEW |