(shouldThrow, block, expected, message)
| 315 | } |
| 316 | |
| 317 | function _throws(shouldThrow, block, expected, message) { |
| 318 | var actual; |
| 319 | |
| 320 | if (typeof expected === 'string') { |
| 321 | message = expected; |
| 322 | expected = null; |
| 323 | } |
| 324 | |
| 325 | try { |
| 326 | block(); |
| 327 | } catch (e) { |
| 328 | actual = e; |
| 329 | } |
| 330 | |
| 331 | message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + |
| 332 | (message ? ' ' + message : '.'); |
| 333 | |
| 334 | if (shouldThrow && !actual) { |
| 335 | fail('Missing expected exception' + message); |
| 336 | } |
| 337 | |
| 338 | if (!shouldThrow && expectedException(actual, expected)) { |
| 339 | fail('Got unwanted exception' + message); |
| 340 | } |
| 341 | |
| 342 | if ((shouldThrow && actual && expected && |
| 343 | !expectedException(actual, expected)) || (!shouldThrow && actual)) { |
| 344 | throw actual; |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | // 11. Expected to throw an error: |
| 349 | // assert.throws(block, Error_opt, message_opt); |
nothing calls this directly
no test coverage detected
searching dependent graphs…