OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Test that dart2js can handle unexpected exception types. | 5 // Test that dart2js can handle unexpected exception types. |
6 | 6 |
7 library native_exception_test; | 7 library native_exception_test; |
8 | 8 |
9 import 'dart:_foreign_helper' show JS; | 9 import 'native_testing.dart'; |
10 import 'dart:_js_helper'; | |
11 import 'package:expect/expect.dart'; | |
12 | 10 |
13 main() { | 11 main() { |
14 var previous; | 12 var previous; |
15 check(e) { | 13 check(e) { |
16 print('$e'); | 14 print('$e'); |
17 Expect.equals(e, e); | 15 Expect.equals(e, e); |
18 Expect.notEquals(e, new Object()); | 16 Expect.notEquals(e, new Object()); |
19 Expect.notEquals(e, previous); | 17 Expect.notEquals(e, previous); |
20 previous = e; | 18 previous = e; |
21 return '$e' != '[object Object]'; | 19 return '$e' != '[object Object]'; |
(...skipping 14 matching lines...) Expand all Loading... |
36 Expect.throws(() { | 34 Expect.throws(() { |
37 JS('void', 'throw void 0'); | 35 JS('void', 'throw void 0'); |
38 }, check); | 36 }, check); |
39 Expect.throws(() { | 37 Expect.throws(() { |
40 JS('void', 'throw "a string"'); | 38 JS('void', 'throw "a string"'); |
41 }, check); | 39 }, check); |
42 Expect.throws(() { | 40 Expect.throws(() { |
43 JS('void', 'throw null'); | 41 JS('void', 'throw null'); |
44 }, check); | 42 }, check); |
45 } | 43 } |
OLD | NEW |