Debian Codegraph @

js/src/tests/test262/language/expressions/class/elements/regular-definitions-literal-names.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/class-elements/literal-names.case
3 // - src/class-elements/productions/cls-expr-regular-definitions.template
4 /*---
5 description: Literal property names (regular fields defintion)
6 esid: prod-FieldDefinition
7 features: [class-fields-public, class]
8 flags: [generated]
9 includes: [propertyHelper.js]
10 info: |
11 ClassElement:
12 ...
13 FieldDefinition ;
14
15 FieldDefinition:
16 ClassElementName Initializer_opt
17
18 ClassElementName:
19 PropertyName
20
21 ---*/
22 const fn = function() {}
23
24
25
26 var C = class {
27 a; b = 42;
28 c = fn
29
30 }
31
32 var c = new C();
33
34 assert(
35 !Object.prototype.hasOwnProperty.call(C.prototype, "a"),
36 "a doesn't appear as an own property on C prototype"
37 );
38 assert(
39 !Object.prototype.hasOwnProperty.call(C, "a"),
40 "a doesn't appear as an own property on C constructor"
41 );
42
43 verifyProperty(c, "a", {
44 value: undefined,
45 enumerable: true,
46 writable: true,
47 configurable: true
48 });
49
50 assert(
51 !Object.prototype.hasOwnProperty.call(C.prototype, "b"),
52 "b doesn't appear as an own property on C prototype"
53 );
54 assert(
55 !Object.prototype.hasOwnProperty.call(C, "b"),
56 "b doesn't appear as an own property on C constructor"
57 );
58
59 verifyProperty(c, "b", {
60 value: 42,
61 enumerable: true,
62 writable: true,
63 configurable: true
64 });
65
66 assert(
67 !Object.prototype.hasOwnProperty.call(C.prototype, "c"),
68 "c doesn't appear as an own property on C prototype"
69 );
70 assert(
71 !Object.prototype.hasOwnProperty.call(C, "c"),
72 "c doesn't appear as an own property on C constructor"
73 );
74
75 verifyProperty(c, "c", {
76 value: fn,
77 enumerable: true,
78 writable: true,
79 configurable: true
80 });
81
82
83 reportCompare(0, 0);