Debian Codegraph @

js/src/jit-test/tests/fields/literal.js

raw
1 load(libdir + "asserts.js");
2
3 source = `var y = {
4 x;
5 }`;
6 assertErrorMessage(() => eval(source), SyntaxError, /./);
7
8 // This is legal, and is equivalent to `var y = { x: x };`
9 // source = `var y = {
10 // x
11 // }`;
12 // assertThrowsInstanceOf(() => eval(source), SyntaxError);
13
14 source = `var y = {
15 #x;
16 }`;
17 assertErrorMessage(() => eval(source), SyntaxError, /./);
18
19 source = `var y = {
20 #x
21 }`;
22 assertThrowsInstanceOf(() => eval(source), SyntaxError);
23
24 source = `var y = {
25 x = 2;
26 }`;
27 assertErrorMessage(() => eval(source), SyntaxError, /./);
28
29 source = `var y = {
30 x = 2
31 }`;
32 assertErrorMessage(() => eval(source), SyntaxError, /./);
33
34 source = `var y = {
35 #x = 2;
36 }`;
37 assertErrorMessage(() => eval(source), SyntaxError, /./);
38
39 source = `var y = {
40 #x = 2
41 }`;
42 assertErrorMessage(() => eval(source), SyntaxError, /./);
43
44 if (typeof reportCompare === "function")
45 reportCompare(true, true);