OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 'dart:async'; | 5 import 'dart:async'; |
6 import 'package:async_helper/async_helper.dart'; | 6 import 'package:async_helper/async_helper.dart'; |
7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
8 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
9 | 9 |
10 const String TEST_1 = r""" | 10 const String TEST_1 = r""" |
11 import 'dart:_foreign_helper'; | 11 import 'dart:_foreign_helper'; |
12 main() { | 12 main() { |
13 // present: 'Moose' | 13 // present: 'Moose' |
14 JS('', 'Moose'); | 14 JS('', 'Moose'); |
15 | 15 |
16 // absent: 'Phantom' - pure. | 16 // absent: 'Phantom' - pure. |
17 JS('returns: bool;effects:none;depends:none;throws:never', 'Phantom'); | 17 JS('returns: bool;effects:none;depends:none;throws:never', 'Phantom'); |
18 | 18 |
19 // present: 'Spider' - unused after constant folding 'is', but unpure. | 19 // present: 'Spider' - unused after constant folding 'is', but unpure. |
20 print(JS('returns:bool;effects:none;depends:all', 'Spider') is bool); | 20 print(JS('returns:bool;effects:none;depends:all', 'Spider') is bool); |
21 | 21 |
22 // absent: 'Wasp' - unused after constant folding 'is', and unpure. | 22 // absent: 'Wasp' - unused after constant folding 'is', and unpure. |
23 print(JS('returns:bool;effects:none;depends:all;throws:never', 'Wasp') | 23 print(JS('returns:bool;effects:none;depends:all;throws:never', 'Wasp') |
24 is bool); | 24 is bool); |
25 | 25 |
26 JS('', 'Array'); // absent: "Array" | 26 JS('', 'Array'); // absent: "Array" |
27 } | 27 } |
28 """; | 28 """; |
29 | 29 |
30 const String TEST_2 = r""" | 30 const String TEST_2 = r""" |
31 import 'dart:_foreign_helper'; | 31 import 'dart:_foreign_helper'; |
32 main() { | 32 main() { |
33 var w1 = JS('returns:int;depends:none;effects:none;throws:never', | 33 var w1 = JS('returns:int;depends:none;effects:none;throws:never', |
34 'foo(#)', 1); | 34 'foo(#)', 1); |
35 var w2 = JS('returns:int;depends:none;effects:none;throws:never', | 35 var w2 = JS('returns:int;depends:none;effects:none;throws:never', |
36 'foo(#)', 2); | 36 'foo(#)', 2); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 | 99 |
100 asyncTest(() => Future.wait([ | 100 asyncTest(() => Future.wait([ |
101 check(TEST_1), | 101 check(TEST_1), |
102 check(TEST_2), | 102 check(TEST_2), |
103 check(TEST_3), | 103 check(TEST_3), |
104 check(TEST_4), | 104 check(TEST_4), |
105 check(TEST_5), | 105 check(TEST_5), |
106 ])); | 106 ])); |
107 } | 107 } |
OLD | NEW |