Debian Codegraph @

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