OLD | NEW |
1 /*global self*/ | 1 /*global self*/ |
2 /*jshint latedef: nofunc*/ | 2 /*jshint latedef: nofunc*/ |
3 /* | 3 /* |
4 Distributed under both the W3C Test Suite License [1] and the W3C | 4 Distributed under both the W3C Test Suite License [1] and the W3C |
5 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the | 5 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the |
6 policies and contribution forms [3]. | 6 policies and contribution forms [3]. |
7 | 7 |
8 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license | 8 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license |
9 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license | 9 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license |
10 [3] http://www.w3.org/2004/10/27-testcases | 10 [3] http://www.w3.org/2004/10/27-testcases |
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 { | 1171 { |
1172 try { | 1172 try { |
1173 func.call(this); | 1173 func.call(this); |
1174 assert(false, "assert_throws", description, | 1174 assert(false, "assert_throws", description, |
1175 "${func} did not throw", {func:func}); | 1175 "${func} did not throw", {func:func}); |
1176 } catch (e) { | 1176 } catch (e) { |
1177 if (e instanceof AssertionError) { | 1177 if (e instanceof AssertionError) { |
1178 throw e; | 1178 throw e; |
1179 } | 1179 } |
1180 if (code === null) { | 1180 if (code === null) { |
1181 return; | 1181 throw new AssertionError('Test bug: need to pass exception to as
sert_throws()'); |
1182 } | 1182 } |
1183 if (typeof code === "object") { | 1183 if (typeof code === "object") { |
1184 assert(typeof e == "object" && "name" in e && e.name == code.nam
e, | 1184 assert(typeof e == "object" && "name" in e && e.name == code.nam
e, |
1185 "assert_throws", description, | 1185 "assert_throws", description, |
1186 "${func} threw ${actual} (${actual_name}) expected ${expe
cted} (${expected_name})", | 1186 "${func} threw ${actual} (${actual_name}) expected ${expe
cted} (${expected_name})", |
1187 {func:func, actual:e, actual_name:e.name, | 1187 {func:func, actual:e, actual_name:e.name, |
1188 expected:code, | 1188 expected:code, |
1189 expected_name:code.name}); | 1189 expected_name:code.name}); |
1190 return; | 1190 return; |
1191 } | 1191 } |
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2784 done(); | 2784 done(); |
2785 }; | 2785 }; |
2786 | 2786 |
2787 addEventListener("error", error_handler, false); | 2787 addEventListener("error", error_handler, false); |
2788 addEventListener("unhandledrejection", function(e){ error_handler(e.reason);
}, false); | 2788 addEventListener("unhandledrejection", function(e){ error_handler(e.reason);
}, false); |
2789 | 2789 |
2790 test_environment.on_tests_ready(); | 2790 test_environment.on_tests_ready(); |
2791 | 2791 |
2792 })(); | 2792 })(); |
2793 // vim: set expandtab shiftwidth=4 tabstop=4: | 2793 // vim: set expandtab shiftwidth=4 tabstop=4: |
OLD | NEW |