(func, shouldThrow, constructor)
| 162 | } |
| 163 | |
| 164 | function assert_throws_if(func, shouldThrow, constructor) { |
| 165 | let error = null; |
| 166 | try { |
| 167 | func(); |
| 168 | } catch (e) { |
| 169 | error = e; |
| 170 | } |
| 171 | assert_equals(error !== null, shouldThrow, "shouldThrow mismatch"); |
| 172 | if (shouldThrow && error !== null) { |
| 173 | assert_true(error instanceof constructor); |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | // Constant values used in the tests below |
| 178 | const testStrings = [ |
no test coverage detected