Debian Codegraph @

js/src/tests/test262/language/expressions/class/elements/after-same-line-static-async-gen-string-literal-names.js

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