Debian Codegraph @

js/src/tests/test262/language/statements/class/elements/multiple-stacked-definitions-string-literal-names.js

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