summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Record/syntax.js
blob: 1291cd3babd66319a21d9f222fed6bdb0e9ab931 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// |reftest| skip-if(!this.hasOwnProperty("Record"))

Reflect.parse("#{}");
Reflect.parse("#{ foo: 1, bar: 2 }");
Reflect.parse("#{ foo: 1, bar: 2, }");
Reflect.parse("#{ foo, ...bar }");
Reflect.parse("#{ foo, ...bar, }");
Reflect.parse("#{ foo: 1, ...bar, baz: 2 }");
Reflect.parse("#{ foo }");
Reflect.parse("#{ foo, }");
Reflect.parse("#{ foo, bar }");
Reflect.parse("#{ foo: 1, bar }");
Reflect.parse("#{ foo, bar: 2 }");
Reflect.parse("#{ foo: bar() }");

Reflect.parse("#{ __proto__ }");
Reflect.parse("#{ ['__proto__']: 2 }");

assertThrowsInstanceOf(() => Reflect.parse("#{,}"), SyntaxError);
assertThrowsInstanceOf(() => Reflect.parse("#{ foo() {} }"), SyntaxError);
assertThrowsInstanceOf(() => Reflect.parse("#{ get foo() {} }"), SyntaxError);
assertThrowsInstanceOf(() => Reflect.parse("#{ __proto__: 2 }"), SyntaxError);
assertThrowsInstanceOf(() => Reflect.parse("#{ '__proto__': 2 }"), SyntaxError);
assertThrowsInstanceOf(() => Reflect.parse("#{ foo = 2 }"), SyntaxError);
assertThrowsInstanceOf(() => Reflect.parse("#{ foo } = bar"), SyntaxError);

if (typeof reportCompare === "function") reportCompare(0, 0);