Debian Codegraph @

js/src/tests/test262/language/statements/class/elements/after-same-line-static-async-method-computed-names.js

raw
1 // |reftest| async
2 // This file was procedurally generated from the following sources:
3 // - src/class-elements/computed-names.case
4 // - src/class-elements/productions/cls-decl-after-same-line-static-async-method.template
5 /*---
6 description: Computed property names (field definitions after a static async method in the same line)
7 esid: prod-FieldDefinition
8 features: [class-fields-public, computed-property-names, class, async-functions]
9 flags: [generated, async]
10 includes: [propertyHelper.js]
11 info: |
12 ClassElement:
13 ...
14 FieldDefinition ;
15
16 FieldDefinition:
17 ClassElementName Initializer_opt
18
19 ClassElementName:
20 PropertyName
21
22 ---*/
23 var x = "b";
24
25
26
27 class C {
28 static async m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"];
29
30 }
31
32 var c = new C();
33
34 assert(
35 !Object.prototype.hasOwnProperty.call(c, "m"),
36 "m doesn't appear as an own property on the C instance"
37 );
38 assert(
39 !Object.prototype.hasOwnProperty.call(C.prototype, "m"),
40 "m doesn't appear as an own property on the C prototype"
41 );
42
43 verifyProperty(C, "m", {
44 enumerable: false,
45 configurable: true,
46 writable: true,
47 }, {restore: true});
48
49 C.m().then(function(v) {
50 assert.sameValue(v, 42);
51
52 function assertions() {
53 // Cover $DONE handler for async cases.
54 function $DONE(error) {
55 if (error) {
56 throw new Test262Error('Test262:AsyncTestFailure')
57 }
58 }
59 assert(
60 !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
61 "b doesn't appear as an own property on C prototype"
62 );
63 assert(
64 !Object.prototype.hasOwnProperty.call(C, "b"),
65 "b doesn't appear as an own property on C constructor"
66 );
67
68 verifyProperty(c, "b", {
69 value: 42,
70 enumerable: true,
71 writable: true,
72 configurable: true
73 });
74
75 assert(
76 !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
77 "x doesn't appear as an own property on C prototype"
78 );
79 assert(
80 !Object.prototype.hasOwnProperty.call(C, "x"),
81 "x doesn't appear as an own property on C constructor"
82 );
83 assert(
84 !Object.prototype.hasOwnProperty.call(c, "x"),
85 "x doesn't appear as an own property on C instance"
86 );
87
88 assert(
89 !Object.prototype.hasOwnProperty.call(C.prototype, "10"),
90 "10 doesn't appear as an own property on C prototype"
91 );
92 assert(
93 !Object.prototype.hasOwnProperty.call(C, "10"),
94 "10 doesn't appear as an own property on C constructor"
95 );
96
97 verifyProperty(c, "10", {
98 value: "meep",
99 enumerable: true,
100 writable: true,
101 configurable: true
102 });
103
104 assert(
105 !Object.prototype.hasOwnProperty.call(C.prototype, "not initialized"),
106 "'not initialized' doesn't appear as an own property on C prototype"
107 );
108 assert(
109 !Object.prototype.hasOwnProperty.call(C, "not initialized"),
110 "'not initialized' doesn't appear as an own property on C constructor"
111 );
112
113 verifyProperty(c, "not initialized", {
114 value: undefined,
115 enumerable: true,
116 writable: true,
117 configurable: true
118 });
119 }
120
121 return Promise.resolve(assertions());
122 }).then($DONE, $DONE);