Debian Codegraph @

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

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