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