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 "package:async_helper/async_helper.dart"; |
7 import 'compiler_helper.dart'; | 7 import 'compiler_helper.dart'; |
8 | 8 |
9 const String TEST1 = r""" | 9 const String TEST1 = r""" |
10 var a = [42]; | 10 var a = [42]; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 const String TEST9 = r""" | 82 const String TEST9 = r""" |
83 const b = 42; | 83 const b = 42; |
84 var a = new List(b); | 84 var a = new List(b); |
85 main() { | 85 main() { |
86 return a[1]; | 86 return a[1]; |
87 } | 87 } |
88 """; | 88 """; |
89 | 89 |
90 void checkRangeError(String test, {bool hasRangeError}) { | 90 void checkRangeError(String test, {bool hasRangeError}) { |
91 asyncTest(() => compileAll(test).then((generated) { | 91 asyncTest(() => compileAll(test).then((generated) { |
92 Expect.equals(hasRangeError, generated.contains('ioore')); | 92 Expect.equals(hasRangeError, generated.contains('ioore')); |
93 })); | 93 })); |
94 } | 94 } |
95 | 95 |
96 main() { | 96 main() { |
97 checkRangeError(TEST1, hasRangeError: false); | 97 checkRangeError(TEST1, hasRangeError: false); |
98 checkRangeError(TEST2('insert', 'null, null'), hasRangeError: true); | 98 checkRangeError(TEST2('insert', 'null, null'), hasRangeError: true); |
99 checkRangeError(TEST2('add', 'null'), hasRangeError: true); | 99 checkRangeError(TEST2('add', 'null'), hasRangeError: true); |
100 checkRangeError(TEST2('clear', ''), hasRangeError: true); | 100 checkRangeError(TEST2('clear', ''), hasRangeError: true); |
101 checkRangeError(TEST2('toString', ''), hasRangeError: false); | 101 checkRangeError(TEST2('toString', ''), hasRangeError: false); |
102 checkRangeError(TEST3, hasRangeError: false); | 102 checkRangeError(TEST3, hasRangeError: false); |
103 checkRangeError(TEST4, hasRangeError: true); | 103 checkRangeError(TEST4, hasRangeError: true); |
104 checkRangeError(TEST5, hasRangeError: true); | 104 checkRangeError(TEST5, hasRangeError: true); |
105 checkRangeError(TEST6, hasRangeError: true); | 105 checkRangeError(TEST6, hasRangeError: true); |
106 checkRangeError(TEST7, hasRangeError: false); | 106 checkRangeError(TEST7, hasRangeError: false); |
107 checkRangeError(TEST8, hasRangeError: true); | 107 checkRangeError(TEST8, hasRangeError: true); |
108 checkRangeError(TEST9, hasRangeError: false); | 108 checkRangeError(TEST9, hasRangeError: false); |
109 } | 109 } |
OLD | NEW |