Debian Codegraph @

js/src/tests/test262/language/statements/class/elements/multiple-definitions-computed-symbol-names.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/class-elements/computed-symbol-names.case
3 // - src/class-elements/productions/cls-decl-multiple-definitions.template
4 /*---
5 description: Computed property symbol names (multiple fields definitions)
6 esid: prod-FieldDefinition
7 features: [class-fields-public, Symbol, 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 = Symbol();
23 var y = Symbol();
24
25
26
27 class C {
28 foo = "foobar";
29 m() { return 42 }
30 [x]; [y] = 42
31 m2() { return 39 }
32 bar = "barbaz";
33
34 }
35
36 var c = new C();
37
38 assert.sameValue(c.m(), 42);
39 assert(
40 !Object.prototype.hasOwnProperty.call(c, "m"),
41 "m doesn't appear as an own property on the C instance"
42 );
43 assert.sameValue(c.m, C.prototype.m);
44
45 verifyProperty(C.prototype, "m", {
46 enumerable: false,
47 configurable: true,
48 writable: true,
49 });
50
51 assert.sameValue(c.m2(), 39);
52 assert(!
53 Object.prototype.hasOwnProperty.call(c, "m2"),
54 "m2 doesn't appear as an own property on the C instance"
55 );
56 assert.sameValue(c.m2, C.prototype.m2);
57
58 verifyProperty(C.prototype, "m2", {
59 enumerable: false,
60 configurable: true,
61 writable: true,
62 });
63
64 assert.sameValue(c.foo, "foobar");
65 assert(
66 !Object.prototype.hasOwnProperty.call(C, "foo"),
67 "foo doesn't appear as an own property on the C constructor"
68 );
69 assert(
70 !Object.prototype.hasOwnProperty.call(C.prototype, "foo"),
71 "foo doesn't appear as an own property on the C prototype"
72 );
73
74 verifyProperty(c, "foo", {
75 value: "foobar",
76 enumerable: true,
77 configurable: true,
78 writable: true,
79 });
80
81 assert.sameValue(c.bar, "barbaz");
82 assert(
83 !Object.prototype.hasOwnProperty.call(C, "bar"),
84 "bar doesn't appear as an own property on the C constructor"
85 );
86 assert(
87 !Object.prototype.hasOwnProperty.call(C.prototype, "bar"),
88 "bar doesn't appear as an own property on the C prototype"
89 );
90
91 verifyProperty(c, "bar", {
92 value: "barbaz",
93 enumerable: true,
94 configurable: true,
95 writable: true,
96 });
97
98 assert(
99 !Object.prototype.hasOwnProperty.call(C.prototype, x),
100 "Symbol x doesn't appear as an own property on C prototype"
101 );
102 assert(
103 !Object.prototype.hasOwnProperty.call(C, x),
104 "Symbol x doesn't appear as an own property on C constructor"
105 );
106
107 verifyProperty(c, x, {
108 value: undefined,
109 enumerable: true,
110 writable: true,
111 configurable: true
112 });
113
114 assert(
115 !Object.prototype.hasOwnProperty.call(C.prototype, y),
116 "Symbol y doesn't appear as an own property on C prototype"
117 );
118 assert(
119 !Object.prototype.hasOwnProperty.call(C, y),
120 "Symbol y doesn't appear as an own property on C constructor"
121 );
122
123 verifyProperty(c, y, {
124 value: 42,
125 enumerable: true,
126 writable: true,
127 configurable: true
128 });
129
130 assert(
131 !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
132 "x doesn't appear as an own property on C prototype"
133 );
134 assert(
135 !Object.prototype.hasOwnProperty.call(C, "x"),
136 "x doesn't appear as an own property on C constructor"
137 );
138 assert(
139 !Object.prototype.hasOwnProperty.call(c, "x"),
140 "x doesn't appear as an own property on C instance"
141 );
142
143 assert(
144 !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
145 "y doesn't appear as an own property on C prototype"
146 );
147 assert(
148 !Object.prototype.hasOwnProperty.call(C, "y"),
149 "y doesn't appear as an own property on C constructor"
150 );
151 assert(
152 !Object.prototype.hasOwnProperty.call(c, "y"),
153 "y doesn't appear as an own property on C instance"
154 );
155
156 reportCompare(0, 0);