OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 Extending the W3C testharness.js with locally useful functionality. | |
3 */ | |
4 | |
5 // 'Untyped' checking of exception messages; for when you want | |
6 // to test the error message returned rather than the exact kind. | |
7 function assert_throws_message(func, expected, name) { | |
sof
2015/11/15 09:04:11
This helper doesn't appear to be used, leave it ou
Mike West
2015/11/16 08:57:57
Yup.
| |
8 try { | |
9 func(); | |
10 } catch (ex) { | |
11 assert_equals(String(ex), expected); | |
12 if (name) | |
13 assert_equals(ex.name, name); | |
14 return; | |
15 } | |
16 assert_true(false, 'Expected an exception with string: ' + expected); | |
17 } | |
18 | |
19 function assert_type_error(f, msg) { | |
20 assert_throws(TypeError(), f, msg); | |
21 } | |
22 | |
23 function assert_syntax_error(f, msg) { | |
24 assert_throws(SyntaxError(), f, msg); | |
25 } | |
OLD | NEW |