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 define(['dart_sdk', 'async_helper', 'expect', 'unittest', 'is', 'require'], | 5 define(['dart_sdk', 'async_helper', 'expect', 'unittest', 'is', 'require'], |
6 function(dart_sdk, async_helper, expect, unittest, is, require) { | 6 function(dart_sdk, async_helper, expect, unittest, is, require) { |
7 'use strict'; | 7 'use strict'; |
8 | 8 |
9 async_helper = async_helper.async_helper; | 9 async_helper = async_helper.async_helper; |
10 let minitest = expect.minitest; | 10 let minitest = expect.minitest; |
(...skipping 10 matching lines...) Expand all Loading... |
21 // Test attributes are a list of strings, or a string for a single | 21 // Test attributes are a list of strings, or a string for a single |
22 // attribute. Valid attributes are: | 22 // attribute. Valid attributes are: |
23 // | 23 // |
24 // 'pass' - test passes (default) | 24 // 'pass' - test passes (default) |
25 // 'skip' - don't run the test | 25 // 'skip' - don't run the test |
26 // 'fail' - test fails | 26 // 'fail' - test fails |
27 // 'timeout' - test times out | 27 // 'timeout' - test times out |
28 // 'slow' - use 5s timeout instead of default 2s. | 28 // 'slow' - use 5s timeout instead of default 2s. |
29 // 'helper' - not a test, used by other tests. | 29 // 'helper' - not a test, used by other tests. |
30 // 'unittest' - run separately as a unittest test. | 30 // 'unittest' - run separately as a unittest test. |
31 // 'whitelist' - run with whitelisted type errors allowed | |
32 // | 31 // |
33 // Common combinations: | 32 // Common combinations: |
34 const pass = 'pass'; | 33 const pass = 'pass'; |
35 const fail = 'fail'; | 34 const fail = 'fail'; |
36 const skip_timeout = ['skip', 'timeout']; | 35 const skip_timeout = ['skip', 'timeout']; |
37 | 36 |
38 // Browsers | 37 // Browsers |
39 const firefox_fail = is.firefox() ? fail : pass; | 38 const firefox_fail = is.firefox() ? fail : pass; |
40 const chrome_fail = is.chrome() ? fail : pass; | 39 const chrome_fail = is.chrome() ? fail : pass; |
41 | 40 |
42 // These are typically tests with asynchronous exceptions that our | 41 // These are typically tests with asynchronous exceptions that our |
43 // test framework doesn't always catch. | 42 // test framework doesn't always catch. |
44 const flaky = 'skip'; | 43 const flaky = 'skip'; |
45 const whitelist = 'whitelist'; | |
46 | 44 |
47 // Tests marked with this are still using the deprecated unittest package | 45 // Tests marked with this are still using the deprecated unittest package |
48 // because they rely on its support for futures and asynchronous tests, which | 46 // because they rely on its support for futures and asynchronous tests, which |
49 // expect and minitest do not handle. | 47 // expect and minitest do not handle. |
50 // TODO(rnystrom): Move all of these away from using the async test API so | 48 // TODO(rnystrom): Move all of these away from using the async test API so |
51 // they can stop using unittest. | 49 // they can stop using unittest. |
52 const async_unittest = ['unittest', 'skip', 'fail']; | 50 const async_unittest = ['unittest', 'skip', 'fail']; |
53 | 51 |
54 // The number of expected unittest errors should be zero but unfortunately | 52 // The number of expected unittest errors should be zero but unfortunately |
55 // there are a lot of broken html unittests. | 53 // there are a lot of broken html unittests. |
(...skipping 19 matching lines...) Expand all Loading... |
75 | 73 |
76 // TODO(vsm): Re-enable (https://github.com/dart-lang/sdk/issues/28319) | 74 // TODO(vsm): Re-enable (https://github.com/dart-lang/sdk/issues/28319) |
77 'async_star_test_none_multi': async_unittest, | 75 'async_star_test_none_multi': async_unittest, |
78 'async_star_test_01_multi': async_unittest, | 76 'async_star_test_01_multi': async_unittest, |
79 'async_star_test_02_multi': async_unittest, | 77 'async_star_test_02_multi': async_unittest, |
80 'async_star_test_03_multi': async_unittest, | 78 'async_star_test_03_multi': async_unittest, |
81 'async_star_test_04_multi': async_unittest, | 79 'async_star_test_04_multi': async_unittest, |
82 'async_star_test_05_multi': async_unittest, | 80 'async_star_test_05_multi': async_unittest, |
83 | 81 |
84 'async_switch_test': fail, | 82 'async_switch_test': fail, |
85 'async_test': whitelist, | |
86 'async_this_bound_test': whitelist, | |
87 'asyncstar_throw_in_catch_test': ['skip', 'fail'], | 83 'asyncstar_throw_in_catch_test': ['skip', 'fail'], |
88 'await_future_test': skip_timeout, | 84 'await_future_test': skip_timeout, |
89 'await_for_test': 'slow', | 85 'await_for_test': 'slow', |
90 'bit_operations_test_none_multi': fail, // DDC/dart2js canonicalize bitop
results to unsigned | 86 'bit_operations_test_none_multi': fail, // DDC/dart2js canonicalize bitop
results to unsigned |
91 'branch_canonicalization_test': fail, // JS bit operations truncate to 32
bits. | 87 'branch_canonicalization_test': fail, // JS bit operations truncate to 32
bits. |
92 'call_closurization_test': fail, // Functions do not expose a "call" metho
d. | 88 'call_closurization_test': fail, // Functions do not expose a "call" metho
d. |
93 'canonical_const2_test': fail, | 89 'canonical_const2_test': fail, |
94 'canonical_const_test': fail, | 90 'canonical_const_test': fail, |
95 'compile_time_constant10_test_none_multi': fail, | 91 'compile_time_constant10_test_none_multi': fail, |
96 'compile_time_constant_a_test': fail, | 92 'compile_time_constant_a_test': fail, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 'issue23244_test': fail, | 157 'issue23244_test': fail, |
162 'invocation_mirror_test': fail, // dcall does not correctly detect named a
rguments | 158 'invocation_mirror_test': fail, // dcall does not correctly detect named a
rguments |
163 'invocation_mirror2_test': fail, // JsInstanceMirror.delegate unimplemente
d | 159 'invocation_mirror2_test': fail, // JsInstanceMirror.delegate unimplemente
d |
164 'lazy_static3_test': fail, | 160 'lazy_static3_test': fail, |
165 'least_upper_bound_expansive_test_none_multi': fail, | 161 'least_upper_bound_expansive_test_none_multi': fail, |
166 'left_shift_test': fail, | 162 'left_shift_test': fail, |
167 'list_is_test': fail, | 163 'list_is_test': fail, |
168 'list_literal3_test': fail, | 164 'list_literal3_test': fail, |
169 'main_test_03_multi': fail, | 165 'main_test_03_multi': fail, |
170 'many_generic_instanceof_test': fail, | 166 'many_generic_instanceof_test': fail, |
171 'many_named_arguments_test': whitelist, | |
172 'map_literal10_test': fail, | 167 'map_literal10_test': fail, |
173 'map_literal7_test': fail, | 168 'map_literal7_test': fail, |
174 'memory_swap_test': skip_timeout, | 169 'memory_swap_test': skip_timeout, |
175 'mint_arithmetic_test': fail, | 170 'mint_arithmetic_test': fail, |
176 'modulo_test': fail, | 171 'modulo_test': fail, |
177 'named_parameter_clash_test': fail, | 172 'named_parameter_clash_test': fail, |
178 'named_parameters_passing_falsy_test': is.firefox('<=50') ? fail : pass, | 173 'named_parameters_passing_falsy_test': is.firefox('<=50') ? fail : pass, |
179 'nan_identical_test': fail, | 174 'nan_identical_test': fail, |
180 'nested_switch_label_test': fail, | 175 'nested_switch_label_test': fail, |
181 'number_identifier_test_05_multi': fail, | 176 'number_identifier_test_05_multi': fail, |
182 'number_identity2_test': fail, | 177 'number_identity2_test': fail, |
183 'numbers_test': fail, | 178 'numbers_test': fail, |
184 'reg_exp_test': whitelist, | |
185 'regress_16640_test': fail, | 179 'regress_16640_test': fail, |
186 'regress_22445_test': fail, | 180 'regress_22445_test': fail, |
187 'regress_22666_test': fail, | 181 'regress_22666_test': fail, |
188 'regress_22777_test': flaky, | 182 'regress_22777_test': flaky, |
189 'stack_overflow_stacktrace_test': fail, | 183 'stack_overflow_stacktrace_test': fail, |
190 'stack_overflow_test': fail, | 184 'stack_overflow_test': fail, |
191 'stacktrace_test': chrome_fail, | 185 'stacktrace_test': chrome_fail, |
192 'switch_label2_test': fail, | 186 'switch_label2_test': fail, |
193 'switch_label_test': fail, | 187 'switch_label_test': fail, |
194 'switch_try_catch_test': fail, | 188 'switch_try_catch_test': fail, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 'hash_map2_test': skip_timeout, | 251 'hash_map2_test': skip_timeout, |
258 'hash_set_test_01_multi': fail, | 252 'hash_set_test_01_multi': fail, |
259 'int_modulo_arith_test_bignum_multi': fail, | 253 'int_modulo_arith_test_bignum_multi': fail, |
260 'int_modulo_arith_test_modPow_multi': fail, | 254 'int_modulo_arith_test_modPow_multi': fail, |
261 'int_modulo_arith_test_none_multi': fail, | 255 'int_modulo_arith_test_none_multi': fail, |
262 'int_parse_radix_test_01_multi': fail, // JS implementations disagree on U
+0085 being whitespace. | 256 'int_parse_radix_test_01_multi': fail, // JS implementations disagree on U
+0085 being whitespace. |
263 'int_parse_radix_test_02_multi': ['fail', 'timeout', 'skip'], // No bigint
s. | 257 'int_parse_radix_test_02_multi': ['fail', 'timeout', 'skip'], // No bigint
s. |
264 'int_parse_radix_test_none_multi': ['slow'], | 258 'int_parse_radix_test_none_multi': ['slow'], |
265 'integer_to_radix_string_test': fail, | 259 'integer_to_radix_string_test': fail, |
266 'integer_to_string_test_01_multi': fail, | 260 'integer_to_string_test_01_multi': fail, |
267 'iterable_empty_test': whitelist, | |
268 'iterable_join_test': whitelist, | |
269 'iterable_return_type_test_02_multi': fail, | 261 'iterable_return_type_test_02_multi': fail, |
270 'json_map_test': fail, | 262 'json_map_test': fail, |
271 'list_fill_range_test': fail, | 263 'list_fill_range_test': fail, |
272 'list_insert_all_test': whitelist, | |
273 'list_replace_range_test': fail, | 264 'list_replace_range_test': fail, |
274 'list_set_all_test': fail, | 265 'list_set_all_test': fail, |
275 'list_sort_test': fail, // runtime strong mode error | |
276 'list_test_01_multi': fail, | 266 'list_test_01_multi': fail, |
277 'list_test_none_multi': fail, | 267 'list_test_none_multi': fail, |
278 'main_test': fail, | 268 'main_test': fail, |
279 'map_keys2_test': fail, | 269 'map_keys2_test': fail, |
280 'map_from_iterable_test': is.firefox('<=50') ? fail : pass, | 270 'map_from_iterable_test': is.firefox('<=50') ? fail : pass, |
281 'nan_infinity_test_01_multi': fail, | 271 'nan_infinity_test_01_multi': fail, |
282 'null_nosuchmethod_test': fail, | 272 'null_nosuchmethod_test': fail, |
283 'reg_exp_all_matches_test': whitelist, | |
284 'reg_exp_start_end_test': whitelist, | |
285 'regress_r21715_test': fail, | 273 'regress_r21715_test': fail, |
286 'sort_test': whitelist, | |
287 'splay_tree_from_iterable_test': is.firefox('<=50') ? fail : pass, | 274 'splay_tree_from_iterable_test': is.firefox('<=50') ? fail : pass, |
288 'string_case_test_01_multi': firefox_fail, | 275 'string_case_test_01_multi': firefox_fail, |
289 'string_fromcharcodes_test': skip_timeout, | 276 'string_fromcharcodes_test': skip_timeout, |
290 'string_operations_with_null_test': fail, | 277 'string_operations_with_null_test': fail, |
291 'string_split_test': whitelist, | |
292 'string_trimlr_test_01_multi': is.chrome('<=58') ? fail : pass, | 278 'string_trimlr_test_01_multi': is.chrome('<=58') ? fail : pass, |
293 'string_trimlr_test_none_multi': is.chrome('<=58') ? fail : pass, | 279 'string_trimlr_test_none_multi': is.chrome('<=58') ? fail : pass, |
294 'symbol_operator_test_03_multi': fail, | 280 'symbol_operator_test_03_multi': fail, |
295 'symbol_operator_test_none_multi': fail, | 281 'symbol_operator_test_none_multi': fail, |
296 'symbol_reserved_word_test_06_multi': fail, | 282 'symbol_reserved_word_test_06_multi': fail, |
297 'symbol_reserved_word_test_09_multi': fail, | 283 'symbol_reserved_word_test_09_multi': fail, |
298 'symbol_reserved_word_test_12_multi': fail, | 284 'symbol_reserved_word_test_12_multi': fail, |
299 'symbol_test_none_multi': fail, | 285 'symbol_test_none_multi': fail, |
300 'unicode_test': firefox_fail, | 286 'unicode_test': firefox_fail, |
301 'uri_parameters_all_test': is.firefox('<=50') ? fail : pass, | 287 'uri_parameters_all_test': is.firefox('<=50') ? fail : pass, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 'timer_isActive_test': async_unittest, | 342 'timer_isActive_test': async_unittest, |
357 'timer_not_available_test': fail, | 343 'timer_not_available_test': fail, |
358 'timer_repeat_test': async_unittest, | 344 'timer_repeat_test': async_unittest, |
359 'timer_test': async_unittest, | 345 'timer_test': async_unittest, |
360 'zone_bind_callback_test': fail, | 346 'zone_bind_callback_test': fail, |
361 'zone_error_callback_test': fail, | 347 'zone_error_callback_test': fail, |
362 'zone_register_callback_test': fail, | 348 'zone_register_callback_test': fail, |
363 'zone_run_unary_test': fail, | 349 'zone_run_unary_test': fail, |
364 }, | 350 }, |
365 | 351 |
366 'lib/collection': { | 352 'lib/collection': {}, |
367 'linked_list_test': whitelist, | |
368 }, | |
369 | 353 |
370 'lib/convert': { | 354 'lib/convert': { |
371 'base64_test_01_multi': 'slow', | 355 'base64_test_01_multi': 'slow', |
372 'chunked_conversion_utf82_test': whitelist, | 356 'chunked_conversion_utf85_test': 'slow', |
373 'chunked_conversion_utf83_test': whitelist, | |
374 'chunked_conversion_utf85_test': ['whitelist', 'slow'], | |
375 'chunked_conversion_utf86_test': whitelist, | |
376 'chunked_conversion_utf87_test': whitelist, | |
377 | 357 |
378 'encoding_test': skip_timeout, | 358 'encoding_test': skip_timeout, |
379 | 359 |
380 'json_utf8_chunk_test': skip_timeout, | 360 'json_utf8_chunk_test': skip_timeout, |
381 'latin1_test': skip_timeout, | 361 'latin1_test': skip_timeout, |
382 | 362 |
383 'streamed_conversion_json_decode1_test': whitelist, | |
384 'streamed_conversion_json_encode1_test': skip_timeout, | 363 'streamed_conversion_json_encode1_test': skip_timeout, |
385 'streamed_conversion_json_utf8_decode_test': skip_timeout, | 364 'streamed_conversion_json_utf8_decode_test': skip_timeout, |
386 'streamed_conversion_json_utf8_encode_test': skip_timeout, | 365 'streamed_conversion_json_utf8_encode_test': skip_timeout, |
387 'streamed_conversion_utf8_decode_test': skip_timeout, | 366 'streamed_conversion_utf8_decode_test': skip_timeout, |
388 'streamed_conversion_utf8_encode_test': skip_timeout, | 367 'streamed_conversion_utf8_encode_test': skip_timeout, |
389 'utf82_test': whitelist, | |
390 'utf85_test': skip_timeout, | 368 'utf85_test': skip_timeout, |
391 'utf8_encode_test': whitelist, | |
392 'utf8_test': whitelist, | |
393 }, | 369 }, |
394 | 370 |
395 'lib/html': { | 371 'lib/html': { |
396 'async_spawnuri_test': async_unittest, | 372 'async_spawnuri_test': async_unittest, |
397 'async_test': async_unittest, | 373 'async_test': async_unittest, |
398 | 374 |
399 // was https://github.com/dart-lang/sdk/issues/27578, needs triage | 375 // was https://github.com/dart-lang/sdk/issues/27578, needs triage |
400 'audiocontext_test': is.chrome('<=54') ? fail : pass, | 376 'audiocontext_test': is.chrome('<=54') ? fail : pass, |
401 | 377 |
402 'canvas_test': ['unittest'], | 378 'canvas_test': ['unittest'], |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 'pi_test': skip_timeout, | 498 'pi_test': skip_timeout, |
523 'random_big_test': fail, | 499 'random_big_test': fail, |
524 }, | 500 }, |
525 | 501 |
526 'lib/typed_data': { | 502 'lib/typed_data': { |
527 // No bigint or int64 support | 503 // No bigint or int64 support |
528 'int32x4_bigint_test': fail, | 504 'int32x4_bigint_test': fail, |
529 'int64_list_load_store_test': fail, | 505 'int64_list_load_store_test': fail, |
530 'typed_data_hierarchy_int64_test': fail, | 506 'typed_data_hierarchy_int64_test': fail, |
531 'typed_data_list_test': fail, | 507 'typed_data_list_test': fail, |
532 'typed_list_iterable_test': whitelist, | |
533 }, | 508 }, |
534 | 509 |
535 'lib/mirrors': { | 510 'lib/mirrors': { |
536 'abstract_class_test_none_multi': fail, | 511 'abstract_class_test_none_multi': fail, |
537 'accessor_cache_overflow_test': fail, | 512 'accessor_cache_overflow_test': fail, |
538 'basic_types_in_dart_core_test': fail, | 513 'basic_types_in_dart_core_test': fail, |
539 'class_mirror_location_test': fail, | 514 'class_mirror_location_test': fail, |
540 'class_mirror_type_variables_test': fail, | 515 'class_mirror_type_variables_test': fail, |
541 'closurization_equivalence_test': fail, | 516 'closurization_equivalence_test': fail, |
542 'constructor_kinds_test_01_multi': fail, | 517 'constructor_kinds_test_01_multi': fail, |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 // timeout. | 747 // timeout. |
773 // | 748 // |
774 // TODO(vsm): This currently doesn't handle tests that trigger multiple | 749 // TODO(vsm): This currently doesn't handle tests that trigger multiple |
775 // asynchronous exceptions. | 750 // asynchronous exceptions. |
776 | 751 |
777 let mainLibrary = require(module)[libraryName(name)]; | 752 let mainLibrary = require(module)[libraryName(name)]; |
778 let negative = /negative_test/.test(name) || | 753 let negative = /negative_test/.test(name) || |
779 mainLibrary._expectRuntimeError; | 754 mainLibrary._expectRuntimeError; |
780 let fail = has('fail'); | 755 let fail = has('fail'); |
781 | 756 |
782 let whitelist = has('whitelist'); | |
783 dart_sdk.dart.ignoreWhitelistedErrors(whitelist); | |
784 | |
785 function finish(error) { | 757 function finish(error) { |
786 // If the test left any lingering detritus in the DOM, blow it away | 758 // If the test left any lingering detritus in the DOM, blow it away |
787 // so it doesn't interfere with later tests. | 759 // so it doesn't interfere with later tests. |
788 if (fail) { | 760 if (fail) { |
789 if (negative) { | 761 if (negative) { |
790 if (error) { | 762 if (error) { |
791 error = new Error( | 763 error = new Error( |
792 "negative test marked as 'fail' " + | 764 "negative test marked as 'fail' " + |
793 "but passed by throwing:\n" + error); | 765 "but passed by throwing:\n" + error); |
794 } | 766 } |
795 } else if (error) { | 767 } else if (error) { |
796 error = null | 768 error = null |
797 } else { | 769 } else { |
798 error = new Error("test marked as 'fail' but passed"); | 770 error = new Error("test marked as 'fail' but passed"); |
799 } | 771 } |
800 } else if (negative) { | 772 } else if (negative) { |
801 if (!error) { | 773 if (!error) { |
802 error = new Error("test marked as 'negative' but did not throw"); | 774 error = new Error("test marked as 'negative' but did not throw"); |
803 } else { | 775 } else { |
804 error = null; | 776 error = null; |
805 } | 777 } |
806 } | 778 } |
807 minitest.finishTests(); | 779 minitest.finishTests(); |
808 document.body.innerHTML = ''; | 780 document.body.innerHTML = ''; |
809 console.log("cleared"); | 781 console.log("cleared"); |
810 if (error && !(error instanceof Error)) error = new Error(error); | 782 if (error && !(error instanceof Error)) error = new Error(error); |
811 dart_sdk.dart.ignoreWhitelistedErrors(false); | |
812 done(error); | 783 done(error); |
813 } | 784 } |
814 | 785 |
815 // Intercept uncaught exceptions | 786 // Intercept uncaught exceptions |
816 window.onerror = function(message, url, line, column, error) { | 787 window.onerror = function(message, url, line, column, error) { |
817 console.warn('Asynchronous error in ' + name + ': ' + message); | 788 console.warn('Asynchronous error in ' + name + ': ' + message); |
818 if (!error) { | 789 if (!error) { |
819 error = new Error(message); | 790 error = new Error(message); |
820 } | 791 } |
821 finish(error); | 792 finish(error); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 | 881 |
911 for (let action of unittest_tests) { | 882 for (let action of unittest_tests) { |
912 try { | 883 try { |
913 action(); | 884 action(); |
914 } catch (e) { | 885 } catch (e) { |
915 console.error("Caught error tying to setup test:", e); | 886 console.error("Caught error tying to setup test:", e); |
916 } | 887 } |
917 } | 888 } |
918 }); | 889 }); |
919 }); | 890 }); |
OLD | NEW |