summaryrefslogtreecommitdiff
path: root/src/class-fields/literal-names.case
diff options
context:
space:
mode:
Diffstat (limited to 'src/class-fields/literal-names.case')
-rw-r--r--src/class-fields/literal-names.case57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/class-fields/literal-names.case b/src/class-fields/literal-names.case
new file mode 100644
index 000000000..9237fd989
--- /dev/null
+++ b/src/class-fields/literal-names.case
@@ -0,0 +1,57 @@
+// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-FieldDefinition
+desc: Literal property names
+info: |
+ ClassElement:
+ ...
+ FieldDefinition ;
+
+ FieldDefinition:
+ ClassElementName Initializer_opt
+
+ ClassElementName:
+ PropertyName
+template: default
+includes: [propertyHelper.js]
+---*/
+
+//- setup
+const fn = function() {}
+
+//- fields
+a; b = 42;
+c = fn
+//- assertions
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false);
+assert.sameValue(Object.hasOwnProperty.call(C, "a"), false);
+
+verifyProperty(c, "a", {
+ value: undefined,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false);
+assert.sameValue(Object.hasOwnProperty.call(C, "b"), false);
+
+verifyProperty(c, "b", {
+ value: 42,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+
+assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false);
+assert.sameValue(Object.hasOwnProperty.call(C, "c"), false);
+
+verifyProperty(c, "c", {
+ value: fn,
+ enumerable: true,
+ writable: true,
+ configurable: true
+});
+