Debian Codegraph @

js/src/tests/test262/language/expressions/class/elements/wrapped-in-sc-computed-names.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/class-elements/computed-names.case
3 // - src/class-elements/productions/cls-expr-wrapped-in-sc.template
4 /*---
5 description: Computed property names (fields definition wrapped in semicolons)
6 esid: prod-FieldDefinition
7 features: [class-fields-public, computed-property-names, class]
8 flags: [generated]
9 includes: [propertyHelper.js]
10 info: |
11 ClassElement:
12 ...
13 FieldDefinition ;
14
15 FieldDefinition:
16 ClassElementName Initializer_opt
17
18 ClassElementName:
19 PropertyName
20
21 ---*/
22 var x = "b";
23
24
25
26 var C = class {
27 ;;;;
28 ;;;;;;[x] = 42; [10] = "meep"; ["not initialized"];;;;;;;
29 ;;;;
30
31 }
32
33 var c = new C();
34
35 assert(
36 !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
37 "b doesn't appear as an own property on C prototype"
38 );
39 assert(
40 !Object.prototype.hasOwnProperty.call(C, "b"),
41 "b doesn't appear as an own property on C constructor"
42 );
43
44 verifyProperty(c, "b", {
45 value: 42,
46 enumerable: true,
47 writable: true,
48 configurable: true
49 });
50
51 assert(
52 !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
53 "x doesn't appear as an own property on C prototype"
54 );
55 assert(
56 !Object.prototype.hasOwnProperty.call(C, "x"),
57 "x doesn't appear as an own property on C constructor"
58 );
59 assert(
60 !Object.prototype.hasOwnProperty.call(c, "x"),
61 "x doesn't appear as an own property on C instance"
62 );
63
64 assert(
65 !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
66 "10 doesn't appear as an own property on C prototype"
67 );
68 assert(
69 !Object.prototype.hasOwnProperty.call(C, "10"),
70 "10 doesn't appear as an own property on C constructor"
71 );
72
73 verifyProperty(c, "10", {
74 value: "meep",
75 enumerable: true,
76 writable: true,
77 configurable: true
78 });
79
80 assert(
81 !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
82 "'not initialized' doesn't appear as an own property on C prototype"
83 );
84 assert(
85 !Object.prototype.hasOwnProperty.call(C, "not initialized"),
86 "'not initialized' doesn't appear as an own property on C constructor"
87 );
88
89 verifyProperty(c, "not initialized", {
90 value: undefined,
91 enumerable: true,
92 writable: true,
93 configurable: true
94 });
95
96 reportCompare(0, 0);