OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This test reflectively enumerates all the methods in the system and tries to | 5 // This test reflectively enumerates all the methods in the system and tries to |
6 // invoke them with various basic values (nulls, ints, etc). This may result in | 6 // invoke them with various basic values (nulls, ints, etc). This may result in |
7 // Dart exceptions or hangs, but should never result in crashes or JavaScript | 7 // Dart exceptions or hangs, but should never result in crashes or JavaScript |
8 // exceptions. | 8 // exceptions. |
9 | 9 |
10 library test.invoke_natives; | 10 library test.invoke_natives; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 // scheduled in the current task. This isn't necessary for the test itself, | 157 // scheduled in the current task. This isn't necessary for the test itself, |
158 // but is helpful when trying to figure out which function is responsible for | 158 // but is helpful when trying to figure out which function is responsible for |
159 // a crash. | 159 // a crash. |
160 testZone.createTimer(Duration.ZERO, doOneTask); | 160 testZone.createTimer(Duration.ZERO, doOneTask); |
161 } | 161 } |
162 | 162 |
163 var fuzzArgument; | 163 var fuzzArgument; |
164 | 164 |
165 main() { | 165 main() { |
166 fuzzArgument = null; | 166 fuzzArgument = null; |
167 fuzzArgument = 1; /// smi: ok | 167 fuzzArgument = 1; // /// smi: ok |
168 fuzzArgument = false; /// false: ok | 168 fuzzArgument = false; // /// false: ok |
169 fuzzArgument = 'string'; /// string: ok | 169 fuzzArgument = 'string'; // /// string: ok |
170 fuzzArgument = new List(0); /// emptyarray: ok | 170 fuzzArgument = new List(0); // /// emptyarray: ok |
171 | 171 |
172 print('Fuzzing with $fuzzArgument'); | 172 print('Fuzzing with $fuzzArgument'); |
173 | 173 |
174 currentMirrorSystem().libraries.values.forEach(checkLibrary); | 174 currentMirrorSystem().libraries.values.forEach(checkLibrary); |
175 | 175 |
176 var valueObjects = | 176 var valueObjects = |
177 [true, false, null, [], {}, dynamic, | 177 [true, false, null, [], {}, dynamic, |
178 0, 0xEFFFFFF, 0xFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 3.14159, | 178 0, 0xEFFFFFF, 0xFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 3.14159, |
179 "foo", 'blåbærgrød', 'Îñţérñåţîöñåļîžåţîờñ', "\u{1D11E}", #symbol]; | 179 "foo", 'blåbærgrød', 'Îñţérñåţîöñåļîžåţîờñ', "\u{1D11E}", #symbol]; |
180 valueObjects.forEach((v) => checkInstance(reflect(v), 'value object')); | 180 valueObjects.forEach((v) => checkInstance(reflect(v), 'value object')); |
181 | 181 |
182 uncaughtErrorHandler(self, parent, zone, error, stack) {}; | 182 uncaughtErrorHandler(self, parent, zone, error, stack) {}; |
183 var zoneSpec = | 183 var zoneSpec = |
184 new ZoneSpecification(handleUncaughtError: uncaughtErrorHandler); | 184 new ZoneSpecification(handleUncaughtError: uncaughtErrorHandler); |
185 testZone = Zone.current.fork(specification: zoneSpec); | 185 testZone = Zone.current.fork(specification: zoneSpec); |
186 testZone.createTimer(Duration.ZERO, doOneTask); | 186 testZone.createTimer(Duration.ZERO, doOneTask); |
187 } | 187 } |
OLD | NEW |