Debian Codegraph @

js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-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-expr-after-same-line-static-async-gen.template
5 /*---
6 description: Computed property symbol names (field definitions after a static async generator in the same line)
7 esid: prod-FieldDefinition
8 features: [class-fields-public, Symbol, computed-property-names, class, async-iteration]
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 var C = class {
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().next().then(function(v) {
51 assert.sameValue(v.value, 42);
52 assert.sameValue(v.done, true);
53
54 function assertions() {
55 // Cover $DONE handler for async cases.
56 function $DONE(error) {
57 if (error) {
58 throw new Test262Error('Test262:AsyncTestFailure')
59 }
60 }
61 assert(
62 !Object.prototype.hasOwnProperty.call(C.prototype, x),
63 "Symbol x doesn't appear as an own property on C prototype"
64 );
65 assert(
66 !Object.prototype.hasOwnProperty.call(C, x),
67 "Symbol x doesn't appear as an own property on C constructor"
68 );
69
70 verifyProperty(c, x, {
71 value: undefined,
72 enumerable: true,
73 writable: true,
74 configurable: true
75 });
76
77 assert(
78 !Object.prototype.hasOwnProperty.call(C.prototype, y),
79 "Symbol y doesn't appear as an own property on C prototype"
80 );
81 assert(
82 !Object.prototype.hasOwnProperty.call(C, y),
83 "Symbol y doesn't appear as an own property on C constructor"
84 );
85
86 verifyProperty(c, y, {
87 value: 42,
88 enumerable: true,
89 writable: true,
90 configurable: true
91 });
92
93 assert(
94 !Object.prototype.hasOwnProperty.call(C.prototype, "x"),
95 "x doesn't appear as an own property on C prototype"
96 );
97 assert(
98 !Object.prototype.hasOwnProperty.call(C, "x"),
99 "x doesn't appear as an own property on C constructor"
100 );
101 assert(
102 !Object.prototype.hasOwnProperty.call(c, "x"),
103 "x doesn't appear as an own property on C instance"
104 );
105
106 assert(
107 !Object.prototype.hasOwnProperty.call(C.prototype, "y"),
108 "y doesn't appear as an own property on C prototype"
109 );
110 assert(
111 !Object.prototype.hasOwnProperty.call(C, "y"),
112 "y doesn't appear as an own property on C constructor"
113 );
114 assert(
115 !Object.prototype.hasOwnProperty.call(c, "y"),
116 "y doesn't appear as an own property on C instance"
117 );
118 }
119
120 return Promise.resolve(assertions());
121 }).then($DONE, $DONE);