MCPcopy Create free account
hub / github.com/nodejs/node / shouldThrowSyntaxError

Function shouldThrowSyntaxError

deps/v8/test/mjsunit/harmony/optional-chaining.js:6–17  ·  view source on GitHub ↗
(script)

Source from the content-addressed store, hash-verified

4
5
6function shouldThrowSyntaxError(script) {
7 let error;
8 try {
9 eval(script);
10 } catch (e) {
11 error = e;
12 }
13
14 if (!(error instanceof SyntaxError)) {
15 throw new Error('Expected SyntaxError!');
16 }
17}
18
19assertEquals(undefined?.valueOf(), undefined);
20assertEquals(null?.valueOf(), undefined);

Callers 1

Calls 1

evalFunction · 0.50

Tested by

no test coverage detected