Debian Codegraph @

js/src/tests/test262/harness/assert-throws-primitive.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 description: >
6 Functions that throw primitive values do not satisfy the assertion.
7 ---*/
8 var threw = false;
9
10 try {
11 assert.throws(Error, function() {
12 throw 3;
13 });
14 } catch(err) {
15 threw = true;
16 if (err.constructor !== Test262Error) {
17 throw new Error(
18 'Expected a Test262Error, but a "' + err.constructor.name +
19 '" was thrown.'
20 );
21 }
22 }
23
24 if (threw === false) {
25 throw new Error('Expected a Test262Error, but no error was thrown.');
26 }
27
28 reportCompare(0, 0);