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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // scheduled in the current task. This isn't necessary for the test itself, | 173 // scheduled in the current task. This isn't necessary for the test itself, |
174 // but is helpful when trying to figure out which function is responsible for | 174 // but is helpful when trying to figure out which function is responsible for |
175 // a crash. | 175 // a crash. |
176 testZone.createTimer(Duration.ZERO, doOneTask); | 176 testZone.createTimer(Duration.ZERO, doOneTask); |
177 } | 177 } |
178 | 178 |
179 var fuzzArgument; | 179 var fuzzArgument; |
180 | 180 |
181 main() { | 181 main() { |
182 fuzzArgument = null; | 182 fuzzArgument = null; |
183 fuzzArgument = 1; /// smi: ok | 183 fuzzArgument = 1; // /// smi: ok |
184 fuzzArgument = false; /// false: ok | 184 fuzzArgument = false; // /// false: ok |
185 fuzzArgument = 'string'; /// string: ok | 185 fuzzArgument = 'string'; // /// string: ok |
186 fuzzArgument = new List(0); /// emptyarray: ok | 186 fuzzArgument = new List(0); // /// emptyarray: ok |
187 | 187 |
188 print('Fuzzing with $fuzzArgument'); | 188 print('Fuzzing with $fuzzArgument'); |
189 | 189 |
190 currentMirrorSystem().libraries.values.forEach(checkLibrary); | 190 currentMirrorSystem().libraries.values.forEach(checkLibrary); |
191 | 191 |
192 var valueObjects = | 192 var valueObjects = |
193 [true, false, null, [], {}, dynamic, | 193 [true, false, null, [], {}, dynamic, |
194 0, 0xEFFFFFF, 0xFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 3.14159, () {}, | 194 0, 0xEFFFFFF, 0xFFFFFFFF, 0xFFFFFFFFFFFFFFFF, 3.14159, () {}, |
195 "foo", 'blåbærgrød', 'Îñţérñåţîöñåļîžåţîờñ', "\u{1D11E}", #symbol]; | 195 "foo", 'blåbærgrød', 'Îñţérñåţîöñåļîžåţîờñ', "\u{1D11E}", #symbol]; |
196 valueObjects.forEach((v) => checkInstance(reflect(v), 'value object')); | 196 valueObjects.forEach((v) => checkInstance(reflect(v), 'value object')); |
197 | 197 |
198 uncaughtErrorHandler(self, parent, zone, error, stack) {}; | 198 uncaughtErrorHandler(self, parent, zone, error, stack) {}; |
199 var zoneSpec = | 199 var zoneSpec = |
200 new ZoneSpecification(handleUncaughtError: uncaughtErrorHandler); | 200 new ZoneSpecification(handleUncaughtError: uncaughtErrorHandler); |
201 testZone = Zone.current.fork(specification: zoneSpec); | 201 testZone = Zone.current.fork(specification: zoneSpec); |
202 testZone.createTimer(Duration.ZERO, doOneTask); | 202 testZone.createTimer(Duration.ZERO, doOneTask); |
203 } | 203 } |
OLD | NEW |