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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import "package:async_helper/async_helper.dart"; |
6 import 'compiler_helper.dart'; | 7 import 'compiler_helper.dart'; |
7 | 8 |
8 const String TEST1 = r""" | 9 const String TEST1 = r""" |
9 var a = [42]; | 10 var a = [42]; |
10 main() { | 11 main() { |
11 return a[0]; | 12 return a[0]; |
12 } | 13 } |
13 """; | 14 """; |
14 | 15 |
15 String TEST2(selectorName, args) { | 16 String TEST2(selectorName, args) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 doIt(a) { | 57 doIt(a) { |
57 a.clear(); | 58 a.clear(); |
58 foo(a); | 59 foo(a); |
59 } | 60 } |
60 main() { | 61 main() { |
61 foo(null); | 62 foo(null); |
62 } | 63 } |
63 """; | 64 """; |
64 | 65 |
65 void checkRangeError(String test, {bool hasRangeError}) { | 66 void checkRangeError(String test, {bool hasRangeError}) { |
66 String generated = compileAll(test); | 67 asyncTest(() => compileAll(test).then((generated) { |
67 Expect.equals(hasRangeError, generated.contains('ioore')); | 68 Expect.equals(hasRangeError, generated.contains('ioore')); |
| 69 })); |
68 } | 70 } |
69 | 71 |
70 main() { | 72 main() { |
71 checkRangeError(TEST1, hasRangeError: false); | 73 checkRangeError(TEST1, hasRangeError: false); |
72 checkRangeError(TEST2('insert', 'null, null'), hasRangeError: true); | 74 checkRangeError(TEST2('insert', 'null, null'), hasRangeError: true); |
73 checkRangeError(TEST2('add', 'null'), hasRangeError: true); | 75 checkRangeError(TEST2('add', 'null'), hasRangeError: true); |
74 checkRangeError(TEST2('clear', ''), hasRangeError: true); | 76 checkRangeError(TEST2('clear', ''), hasRangeError: true); |
75 checkRangeError(TEST2('toString', ''), hasRangeError: false); | 77 checkRangeError(TEST2('toString', ''), hasRangeError: false); |
76 checkRangeError(TEST3, hasRangeError: false); | 78 checkRangeError(TEST3, hasRangeError: false); |
77 checkRangeError(TEST4, hasRangeError: true); | 79 checkRangeError(TEST4, hasRangeError: true); |
78 checkRangeError(TEST5, hasRangeError: true); | 80 checkRangeError(TEST5, hasRangeError: true); |
79 checkRangeError(TEST6, hasRangeError: true); | 81 checkRangeError(TEST6, hasRangeError: true); |
80 } | 82 } |
OLD | NEW |