From bd682d8e37ec5c92bfacc72315d1855a25514fec Mon Sep 17 00:00:00 2001
From: Rick Waldron <waldron.rick@gmail.com>
Date: Mon, 2 Mar 2015 14:10:32 -0500
Subject: [PATCH] Import tests from Google V8 (Computed Property Names)

These tests are derived from the following files within the Google V8
project:

        test/mjsunit/harmony/computed-property-names-classes.js
        test/mjsunit/harmony/computed-property-names-object-literals-methods.js
        test/mjsunit/harmony/computed-property-names-super.js
        test/mjsunit/harmony/computed-property-names.js
---
 .../computed-property-names/basics/number.js  | 24 ++++++++
 .../computed-property-names/basics/string.js  | 23 ++++++++
 .../computed-property-names/basics/symbol.js  | 41 ++++++++++++++
 .../class/accessor/getter-duplicates.js       | 47 ++++++++++++++++
 .../class/accessor/getter.js                  | 13 +++++
 .../class/accessor/setter-duplicates.js       | 55 +++++++++++++++++++
 .../class/accessor/setter.js                  | 15 +++++
 .../class/method/constructor.js               | 41 ++++++++++++++
 .../class/method/generator.js                 | 16 ++++++
 .../class/method/number.js                    | 25 +++++++++
 .../class/method/string.js                    | 25 +++++++++
 .../class/method/symbol.js                    | 42 ++++++++++++++
 .../class/static/generator-constructor.js     | 12 ++++
 .../class/static/generator-prototype.js       | 12 ++++
 .../class/static/getter-constructor.js        | 12 ++++
 .../class/static/getter-prototype.js          | 12 ++++
 .../class/static/method-constructor.js        | 12 ++++
 .../class/static/method-number.js             | 20 +++++++
 .../class/static/method-prototype.js          | 12 ++++
 .../class/static/method-string.js             | 20 +++++++
 .../class/static/method-symbol.js             | 38 +++++++++++++
 .../class/static/setter-constructor.js        | 12 ++++
 .../class/static/setter-prototype.js          | 12 ++++
 .../duplicate-keys/data.js                    | 13 +++++
 .../duplicate-keys/method.js                  | 13 +++++
 .../duplicate-keys/numbers.js                 | 23 ++++++++
 .../object/accessor/getter-super.js           | 30 ++++++++++
 .../object/accessor/getter.js                 | 47 ++++++++++++++++
 .../object/accessor/setter-super.js           | 35 ++++++++++++
 .../object/accessor/setter.js                 | 55 +++++++++++++++++++
 .../object/method/generator.js                | 15 +++++
 .../object/method/number.js                   | 24 ++++++++
 .../object/method/string.js                   | 24 ++++++++
 .../object/method/super.js                    | 30 ++++++++++
 .../object/method/symbol.js                   | 41 ++++++++++++++
 .../to-name-side-effects/class.js             | 34 ++++++++++++
 .../to-name-side-effects/numbers-class.js     | 37 +++++++++++++
 .../to-name-side-effects/numbers-object.js    | 36 ++++++++++++
 .../to-name-side-effects/object.js            | 33 +++++++++++
 39 files changed, 1031 insertions(+)
 create mode 100644 test/language/computed-property-names/basics/number.js
 create mode 100644 test/language/computed-property-names/basics/string.js
 create mode 100644 test/language/computed-property-names/basics/symbol.js
 create mode 100644 test/language/computed-property-names/class/accessor/getter-duplicates.js
 create mode 100644 test/language/computed-property-names/class/accessor/getter.js
 create mode 100644 test/language/computed-property-names/class/accessor/setter-duplicates.js
 create mode 100644 test/language/computed-property-names/class/accessor/setter.js
 create mode 100644 test/language/computed-property-names/class/method/constructor.js
 create mode 100644 test/language/computed-property-names/class/method/generator.js
 create mode 100644 test/language/computed-property-names/class/method/number.js
 create mode 100644 test/language/computed-property-names/class/method/string.js
 create mode 100644 test/language/computed-property-names/class/method/symbol.js
 create mode 100644 test/language/computed-property-names/class/static/generator-constructor.js
 create mode 100644 test/language/computed-property-names/class/static/generator-prototype.js
 create mode 100644 test/language/computed-property-names/class/static/getter-constructor.js
 create mode 100644 test/language/computed-property-names/class/static/getter-prototype.js
 create mode 100644 test/language/computed-property-names/class/static/method-constructor.js
 create mode 100644 test/language/computed-property-names/class/static/method-number.js
 create mode 100644 test/language/computed-property-names/class/static/method-prototype.js
 create mode 100644 test/language/computed-property-names/class/static/method-string.js
 create mode 100644 test/language/computed-property-names/class/static/method-symbol.js
 create mode 100644 test/language/computed-property-names/class/static/setter-constructor.js
 create mode 100644 test/language/computed-property-names/class/static/setter-prototype.js
 create mode 100644 test/language/computed-property-names/duplicate-keys/data.js
 create mode 100644 test/language/computed-property-names/duplicate-keys/method.js
 create mode 100644 test/language/computed-property-names/duplicate-keys/numbers.js
 create mode 100644 test/language/computed-property-names/object/accessor/getter-super.js
 create mode 100644 test/language/computed-property-names/object/accessor/getter.js
 create mode 100644 test/language/computed-property-names/object/accessor/setter-super.js
 create mode 100644 test/language/computed-property-names/object/accessor/setter.js
 create mode 100644 test/language/computed-property-names/object/method/generator.js
 create mode 100644 test/language/computed-property-names/object/method/number.js
 create mode 100644 test/language/computed-property-names/object/method/string.js
 create mode 100644 test/language/computed-property-names/object/method/super.js
 create mode 100644 test/language/computed-property-names/object/method/symbol.js
 create mode 100644 test/language/computed-property-names/to-name-side-effects/class.js
 create mode 100644 test/language/computed-property-names/to-name-side-effects/numbers-class.js
 create mode 100644 test/language/computed-property-names/to-name-side-effects/numbers-object.js
 create mode 100644 test/language/computed-property-names/to-name-side-effects/object.js

diff --git a/test/language/computed-property-names/basics/number.js b/test/language/computed-property-names/basics/number.js
new file mode 100644
index 0000000000..389e22050d
--- /dev/null
+++ b/test/language/computed-property-names/basics/number.js
@@ -0,0 +1,24 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    computed property names can be a number
+includes: [compareArray.js]
+---*/
+
+function ID(x) {
+  return x;
+}
+
+var object = {
+  a: 'A',
+  [1]: 'B',
+  c: 'C',
+  [ID(2)]: 'D',
+};
+assert.sameValue(object.a, 'A');
+assert.sameValue(object[1], 'B');
+assert.sameValue(object.c, 'C');
+assert.sameValue(object[2], 'D');
+assert(compareArray(Object.keys(object), ['1', '2', 'a', 'c']));
diff --git a/test/language/computed-property-names/basics/string.js b/test/language/computed-property-names/basics/string.js
new file mode 100644
index 0000000000..f597ee5f5e
--- /dev/null
+++ b/test/language/computed-property-names/basics/string.js
@@ -0,0 +1,23 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    computed property names can be a string
+includes: [compareArray.js]
+---*/
+function ID(x) {
+  return x;
+}
+
+var object = {
+  a: 'A',
+  ['b']: 'B',
+  c: 'C',
+  [ID('d')]: 'D',
+};
+assert.sameValue(object.a, 'A');
+assert.sameValue(object.b, 'B');
+assert.sameValue(object.c, 'C');
+assert.sameValue(object.d, 'D');
+assert(compareArray(Object.keys(object), ['a', 'b', 'c', 'd']));
diff --git a/test/language/computed-property-names/basics/symbol.js b/test/language/computed-property-names/basics/symbol.js
new file mode 100644
index 0000000000..c57b7addfc
--- /dev/null
+++ b/test/language/computed-property-names/basics/symbol.js
@@ -0,0 +1,41 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    computed property names can be a symbol
+includes: [compareArray.js]
+---*/
+
+function ID(x) {
+  return x;
+}
+
+var sym1 = Symbol();
+var sym2 = Symbol();
+var object = {
+  a: 'A',
+  [sym1]: 'B',
+  c: 'C',
+  [ID(sym2)]: 'D',
+};
+assert.sameValue(object.a, 'A');
+assert.sameValue(object[sym1], 'B');
+assert.sameValue(object.c, 'C');
+assert.sameValue(object[sym2], 'D');
+assert(compareArray(Object.keys(object), ['a', 'c']));
+
+// compareArray expects arguments to be sorted,
+// which will cause an array containing symbols to
+// throw an exception when toString() is called.
+//
+// Since there is no guarantee of order:
+//
+//    - Assert only that the symbol is present
+//    - Assert that the length is correct
+//
+var symbols = Object.getOwnPropertySymbols(object);
+
+assert(symbols.indexOf(sym1) !== -1);
+assert(symbols.indexOf(sym2) !== -1);
+assert.sameValue(symbols.length, 2);
diff --git a/test/language/computed-property-names/class/accessor/getter-duplicates.js b/test/language/computed-property-names/class/accessor/getter-duplicates.js
new file mode 100644
index 0000000000..436ea48319
--- /dev/null
+++ b/test/language/computed-property-names/class/accessor/getter-duplicates.js
@@ -0,0 +1,47 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    In a class, duplicate computed property getter names produce only a single property of
+    that name, whose value is the value of the last property of that name.
+---*/
+class C {
+  get ['a']() {
+    return 'A';
+  }
+}
+assert.sameValue(new C().a, 'A');
+
+class C2 {
+  get b() {
+    assert(false);
+  }
+  get ['b']() {
+    return 'B';
+  }
+}
+assert.sameValue(new C2().b, 'B');
+
+class C3 {
+  get c() {
+    assert(false);
+  }
+  get ['c']() {
+    assert(false);
+  }
+  get ['c']() {
+    return 'C';
+  }
+}
+assert.sameValue(new C3().c, 'C');
+
+class C4 {
+  get ['d']() {
+    assert(false);
+  }
+  get d() {
+    return 'D';
+  }
+}
+assert.sameValue(new C4().d, 'D');
diff --git a/test/language/computed-property-names/class/accessor/getter.js b/test/language/computed-property-names/class/accessor/getter.js
new file mode 100644
index 0000000000..eb8faa9914
--- /dev/null
+++ b/test/language/computed-property-names/class/accessor/getter.js
@@ -0,0 +1,13 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    Computed property names for getters
+---*/
+class C {
+  get ['a']() {
+    return 'A';
+  }
+}
+assert.sameValue(new C().a, 'A');
diff --git a/test/language/computed-property-names/class/accessor/setter-duplicates.js b/test/language/computed-property-names/class/accessor/setter-duplicates.js
new file mode 100644
index 0000000000..ac6d4fad94
--- /dev/null
+++ b/test/language/computed-property-names/class/accessor/setter-duplicates.js
@@ -0,0 +1,55 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    In a class, duplicate computed property setter names produce only a single property of
+    that name, whose value is the value of the last property of that name.
+---*/
+var calls = 0;
+class C {
+  set ['a'](_) {
+    calls++;
+  }
+}
+new C().a = 'A';
+assert.sameValue(calls, 1);
+
+calls = 0;
+class C2 {
+  set b(_) {
+    assert(false);
+  }
+  set ['b'](_) {
+    calls++;
+  }
+}
+new C2().b = 'B';
+assert.sameValue(calls, 1);
+
+calls = 0;
+class C3 {
+  set c(_) {
+    assert(false)
+  }
+  set ['c'](_) {
+    assert(false)
+  }
+  set ['c'](_) {
+    calls++
+  }
+}
+new C3().c = 'C';
+assert.sameValue(calls, 1);
+
+calls = 0;
+class C4 {
+  set ['d'](_) {
+    assert(false)
+  }
+  set d(_) {
+    calls++
+  }
+}
+new C4().d = 'D';
+assert.sameValue(calls, 1);
diff --git a/test/language/computed-property-names/class/accessor/setter.js b/test/language/computed-property-names/class/accessor/setter.js
new file mode 100644
index 0000000000..b0cd0a9c6e
--- /dev/null
+++ b/test/language/computed-property-names/class/accessor/setter.js
@@ -0,0 +1,15 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    Computed property names for setters
+---*/
+var calls = 0;
+class C {
+  set ['a'](_) {
+    calls++;
+  }
+}
+new C().a = 'A';
+assert.sameValue(calls, 1);
diff --git a/test/language/computed-property-names/class/method/constructor.js b/test/language/computed-property-names/class/method/constructor.js
new file mode 100644
index 0000000000..82ec2f9211
--- /dev/null
+++ b/test/language/computed-property-names/class/method/constructor.js
@@ -0,0 +1,41 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    computed property names can be "constructor"
+---*/
+class C {
+  ['constructor']() {
+    return 1;
+  }
+}
+assert(C !== C.prototype.constructor);
+assert.sameValue(new C().constructor(), 1);
+
+class C2 {
+  get ['constructor']() {
+    return 2;
+  }
+}
+assert.sameValue(new C2().constructor, 2);
+
+var calls = 0;
+class C3 {
+  set ['constructor'](x) {
+    assert.sameValue(x, 3);
+    calls++;
+  }
+}
+new C3().constructor = 3;
+assert.sameValue(calls, 1);
+
+class C4 {
+  *['constructor']() {
+    yield 1;
+    yield 2;
+  }
+}
+
+assert(C4 !== C4.prototype.constructor);
+assert.sameValue(new C().constructor(), 1);
diff --git a/test/language/computed-property-names/class/method/generator.js b/test/language/computed-property-names/class/method/generator.js
new file mode 100644
index 0000000000..d243c13c19
--- /dev/null
+++ b/test/language/computed-property-names/class/method/generator.js
@@ -0,0 +1,16 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    computed property names can be used as the name of a generator method in a class
+includes: [compareArray.js]
+---*/
+class C {
+  *['a']() {
+    yield 1;
+    yield 2;
+  }
+}
+assert.sameValue(Object.keys(C.prototype).length, 0);
+assert(compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a']));
diff --git a/test/language/computed-property-names/class/method/number.js b/test/language/computed-property-names/class/method/number.js
new file mode 100644
index 0000000000..b09c103909
--- /dev/null
+++ b/test/language/computed-property-names/class/method/number.js
@@ -0,0 +1,25 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    computed property class method names can be a number
+includes: [compareArray.js]
+---*/
+
+function ID(x) {
+  return x;
+}
+
+class C {
+  a() { return 'A'; }
+  [1]() { return 'B'; }
+  c() { return 'C'; }
+  [ID(2)]() { return 'D'; }
+}
+assert.sameValue(new C().a(), 'A');
+assert.sameValue(new C()[1](), 'B');
+assert.sameValue(new C().c(), 'C');
+assert.sameValue(new C()[2](), 'D');
+assert(compareArray(Object.keys(C.prototype), []));
+assert(compareArray(Object.getOwnPropertyNames(C.prototype), ['1', '2', 'constructor', 'a', 'c']));
diff --git a/test/language/computed-property-names/class/method/string.js b/test/language/computed-property-names/class/method/string.js
new file mode 100644
index 0000000000..f4ddb8942b
--- /dev/null
+++ b/test/language/computed-property-names/class/method/string.js
@@ -0,0 +1,25 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    computed property class method names can be a string
+includes: [compareArray.js]
+---*/
+
+function ID(x) {
+  return x;
+}
+
+class C {
+  a() { return 'A'}
+  ['b']() { return 'B'; }
+  c() { return 'C'; }
+  [ID('d')]() { return 'D'; }
+}
+assert.sameValue(new C().a(), 'A');
+assert.sameValue(new C().b(), 'B');
+assert.sameValue(new C().c(), 'C');
+assert.sameValue(new C().d(), 'D');
+assert(compareArray(Object.keys(C.prototype), []));
+assert(compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'b', 'c', 'd']));
diff --git a/test/language/computed-property-names/class/method/symbol.js b/test/language/computed-property-names/class/method/symbol.js
new file mode 100644
index 0000000000..2f5f023aed
--- /dev/null
+++ b/test/language/computed-property-names/class/method/symbol.js
@@ -0,0 +1,42 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    computed property class method names can be a symbol
+includes: [compareArray.js]
+---*/
+
+function ID(x) {
+  return x;
+}
+
+var sym1 = Symbol();
+var sym2 = Symbol();
+class C {
+  a() { return 'A'; }
+  [sym1]() { return 'B'; }
+  c() { return 'C'; }
+  [ID(sym2)]() { return 'D'; }
+}
+assert.sameValue(new C().a(), 'A');
+assert.sameValue(new C()[sym1](), 'B');
+assert.sameValue(new C().c(), 'C');
+assert.sameValue(new C()[sym2](), 'D');
+assert(compareArray(Object.keys(C.prototype), []));
+assert(compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'c']));
+
+// compareArray expects arguments to be sorted,
+// which will cause an array containing symbols to
+// throw an exception when toString() is called.
+//
+// Since there is no guarantee of order:
+//
+//    - Assert only that the symbol is present
+//    - Assert that the length is correct
+//
+var symbols = Object.getOwnPropertySymbols(C.prototype);
+
+assert(symbols.indexOf(sym1) !== -1);
+assert(symbols.indexOf(sym2) !== -1);
+assert.sameValue(symbols.length, 2);
diff --git a/test/language/computed-property-names/class/static/generator-constructor.js b/test/language/computed-property-names/class/static/generator-constructor.js
new file mode 100644
index 0000000000..bb7108b605
--- /dev/null
+++ b/test/language/computed-property-names/class/static/generator-constructor.js
@@ -0,0 +1,12 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    In a class, computed property names for static
+    generators cannot be "constructor"
+negative: SyntaxError
+---*/
+class C {
+  static * ['constructor']() {}
+}
diff --git a/test/language/computed-property-names/class/static/generator-prototype.js b/test/language/computed-property-names/class/static/generator-prototype.js
new file mode 100644
index 0000000000..16c558217b
--- /dev/null
+++ b/test/language/computed-property-names/class/static/generator-prototype.js
@@ -0,0 +1,12 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    In a class, computed property names for static
+    generators cannot be "prototype"
+negative: SyntaxError
+---*/
+class C {
+  static *['prototype']() {}
+}
diff --git a/test/language/computed-property-names/class/static/getter-constructor.js b/test/language/computed-property-names/class/static/getter-constructor.js
new file mode 100644
index 0000000000..3b576dd53a
--- /dev/null
+++ b/test/language/computed-property-names/class/static/getter-constructor.js
@@ -0,0 +1,12 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    In a class, computed property names for static
+    getters cannot be "constructor"
+negative: SyntaxError
+---*/
+class C {
+  static get ['constructor']() {}
+}
diff --git a/test/language/computed-property-names/class/static/getter-prototype.js b/test/language/computed-property-names/class/static/getter-prototype.js
new file mode 100644
index 0000000000..f445ee0f3d
--- /dev/null
+++ b/test/language/computed-property-names/class/static/getter-prototype.js
@@ -0,0 +1,12 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    In a class, computed property names for static
+    getters cannot be "prototype"
+negative: SyntaxError
+---*/
+class C {
+  static get ['prototype']() {}
+}
diff --git a/test/language/computed-property-names/class/static/method-constructor.js b/test/language/computed-property-names/class/static/method-constructor.js
new file mode 100644
index 0000000000..a47c803835
--- /dev/null
+++ b/test/language/computed-property-names/class/static/method-constructor.js
@@ -0,0 +1,12 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    In a class, computed property names for static
+    methods cannot be "constructor"
+negative: SyntaxError
+---*/
+class C {
+  static ['constructor']() {}
+}
diff --git a/test/language/computed-property-names/class/static/method-number.js b/test/language/computed-property-names/class/static/method-number.js
new file mode 100644
index 0000000000..8b76d120a9
--- /dev/null
+++ b/test/language/computed-property-names/class/static/method-number.js
@@ -0,0 +1,20 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    In a class, static computed property method names can be a number
+includes: [compareArray.js]
+---*/
+class C {
+  static a() { return 'A'; }
+  static [1]() { return 'B'; }
+  static c() { return 'C'; }
+  static [2]() { return 'D'; }
+}
+assert.sameValue(C.a(), 'A');
+assert.sameValue(C[1](), 'B');
+assert.sameValue(C.c(), 'C');
+assert.sameValue(C[2](), 'D');
+assert(compareArray(Object.keys(C), []));
+assert(compareArray(Object.getOwnPropertyNames(C), ['1', '2', 'length', 'name', 'prototype', 'a', 'c']));
diff --git a/test/language/computed-property-names/class/static/method-prototype.js b/test/language/computed-property-names/class/static/method-prototype.js
new file mode 100644
index 0000000000..df2f59af12
--- /dev/null
+++ b/test/language/computed-property-names/class/static/method-prototype.js
@@ -0,0 +1,12 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    In a class, computed property names for static
+    methods cannot be "prototype"
+negative: SyntaxError
+---*/
+class C {
+  static ['prototype']() {}
+}
diff --git a/test/language/computed-property-names/class/static/method-string.js b/test/language/computed-property-names/class/static/method-string.js
new file mode 100644
index 0000000000..facc40dc69
--- /dev/null
+++ b/test/language/computed-property-names/class/static/method-string.js
@@ -0,0 +1,20 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    In a class, static computed property method names can be a string
+includes: [compareArray.js]
+---*/
+class C {
+  static a() { return 'A'}
+  static ['b']() { return 'B'; }
+  static c() { return 'C'; }
+  static ['d']() { return 'D'; }
+}
+assert.sameValue(C.a(), 'A');
+assert.sameValue(C.b(), 'B');
+assert.sameValue(C.c(), 'C');
+assert.sameValue(C.d(), 'D');
+assert(compareArray(Object.keys(C), []));
+assert(compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype', 'a', 'b', 'c', 'd']));
diff --git a/test/language/computed-property-names/class/static/method-symbol.js b/test/language/computed-property-names/class/static/method-symbol.js
new file mode 100644
index 0000000000..a6c43a962d
--- /dev/null
+++ b/test/language/computed-property-names/class/static/method-symbol.js
@@ -0,0 +1,38 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    In a class, static computed property method names can be a symbol
+includes: [compareArray.js]
+---*/
+var sym1 = Symbol();
+var sym2 = Symbol();
+class C {
+  static a() { return 'A'; }
+  static [sym1]() { return 'B'; }
+  static c() { return 'C'; }
+  static [sym2]() { return 'D'; }
+}
+assert.sameValue(C.a(), 'A');
+assert.sameValue(C[sym1](), 'B');
+assert.sameValue(C.c(), 'C');
+assert.sameValue(C[sym2](), 'D');
+assert(compareArray(Object.keys(C), []));
+assert(compareArray(Object.getOwnPropertyNames(C), ['length', 'name', 'prototype', 'a', 'c']));
+
+
+// compareArray expects arguments to be sorted,
+// which will cause an array containing symbols to
+// throw an exception when toString() is called.
+//
+// Since there is no guarantee of order:
+//
+//    - Assert only that the symbol is present
+//    - Assert that the length is correct
+//
+var symbols = Object.getOwnPropertySymbols(C);
+
+assert(symbols.indexOf(sym1) !== -1);
+assert(symbols.indexOf(sym2) !== -1);
+assert.sameValue(symbols.length, 2);
diff --git a/test/language/computed-property-names/class/static/setter-constructor.js b/test/language/computed-property-names/class/static/setter-constructor.js
new file mode 100644
index 0000000000..4ee7466c7d
--- /dev/null
+++ b/test/language/computed-property-names/class/static/setter-constructor.js
@@ -0,0 +1,12 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    In a class, computed property names for static
+    setters cannot be "constructor"
+negative: SyntaxError
+---*/
+class C {
+  static set ['constructor'](x) {}
+}
diff --git a/test/language/computed-property-names/class/static/setter-prototype.js b/test/language/computed-property-names/class/static/setter-prototype.js
new file mode 100644
index 0000000000..56505eab05
--- /dev/null
+++ b/test/language/computed-property-names/class/static/setter-prototype.js
@@ -0,0 +1,12 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    In a class, computed property names for static
+    setters cannot be "prototype"
+negative: SyntaxError
+---*/
+class C {
+  static set ['prototype'](x) {}
+}
diff --git a/test/language/computed-property-names/duplicate-keys/data.js b/test/language/computed-property-names/duplicate-keys/data.js
new file mode 100644
index 0000000000..679077b6b7
--- /dev/null
+++ b/test/language/computed-property-names/duplicate-keys/data.js
@@ -0,0 +1,13 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    duplicate computed property names produce only a single property of
+    that name, whose value is the value of the last property of that name.
+---*/
+var object = {
+  a: 1,
+  ['a']: 2,
+};
+assert.sameValue(object.a, 2);
diff --git a/test/language/computed-property-names/duplicate-keys/method.js b/test/language/computed-property-names/duplicate-keys/method.js
new file mode 100644
index 0000000000..350256d530
--- /dev/null
+++ b/test/language/computed-property-names/duplicate-keys/method.js
@@ -0,0 +1,13 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    duplicate computed property method names produce only a single property of
+    that name, whose value is the value of the last property of that name.
+---*/
+var object = {
+  a() { return 1; },
+  ['a']() { return 2; },
+};
+assert.sameValue(object.a(), 2);
diff --git a/test/language/computed-property-names/duplicate-keys/numbers.js b/test/language/computed-property-names/duplicate-keys/numbers.js
new file mode 100644
index 0000000000..95417ecc04
--- /dev/null
+++ b/test/language/computed-property-names/duplicate-keys/numbers.js
@@ -0,0 +1,23 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    computed property names can be numbers
+---*/
+var object = {
+  [1.2]: 'A',
+  [1e55]: 'B',
+  [0.000001]: 'C',
+  [-0]: 'D',
+  [Infinity]: 'E',
+  [-Infinity]: 'F',
+  [NaN]: 'G',
+};
+assert.sameValue(object['1.2'], 'A');
+assert.sameValue(object['1e+55'], 'B');
+assert.sameValue(object['0.000001'], 'C');
+assert.sameValue(object[0], 'D');
+assert.sameValue(object[Infinity], 'E');
+assert.sameValue(object[-Infinity], 'F');
+assert.sameValue(object[NaN], 'G');
diff --git a/test/language/computed-property-names/object/accessor/getter-super.js b/test/language/computed-property-names/object/accessor/getter-super.js
new file mode 100644
index 0000000000..f59b3ce922
--- /dev/null
+++ b/test/language/computed-property-names/object/accessor/getter-super.js
@@ -0,0 +1,30 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    computed property getters can call super methods
+---*/
+
+function ID(x) {
+  return x;
+}
+
+var proto = {
+  m() {
+    return ' proto m';
+  }
+};
+var object = {
+  get ['a']() { return 'a' + super.m(); },
+  get [ID('b')]() { return 'b' + super.m(); },
+  get [0]() { return '0' + super.m(); },
+  get [ID(1)]() { return '1' + super.m(); },
+};
+
+Object.setPrototypeOf(object, proto);
+
+assert.sameValue(object.a, 'a proto m');
+assert.sameValue(object.b, 'b proto m');
+assert.sameValue(object[0], '0 proto m');
+assert.sameValue(object[1], '1 proto m');
diff --git a/test/language/computed-property-names/object/accessor/getter.js b/test/language/computed-property-names/object/accessor/getter.js
new file mode 100644
index 0000000000..d3ee4c0132
--- /dev/null
+++ b/test/language/computed-property-names/object/accessor/getter.js
@@ -0,0 +1,47 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    In an object, duplicate computed property getter names produce only a single property of
+    that name, whose value is the value of the last property of that name.
+---*/
+var object = {
+  get ['a']() {
+    return 'A';
+  }
+};
+assert.sameValue(object.a, 'A');
+
+object = {
+  get b() {
+    assert(false);
+  },
+  get ['b']() {
+    return 'B';
+  }
+};
+assert.sameValue(object.b, 'B');
+
+object = {
+  get c() {
+    assert(false);
+  },
+  get ['c']() {
+    assert(false);
+  },
+  get ['c']() {
+    return 'C';
+  }
+};
+assert.sameValue(object.c, 'C');
+
+object = {
+  get ['d']() {
+    assert(false);
+  },
+  get d() {
+    return 'D';
+  }
+};
+assert.sameValue(object.d, 'D');
diff --git a/test/language/computed-property-names/object/accessor/setter-super.js b/test/language/computed-property-names/object/accessor/setter-super.js
new file mode 100644
index 0000000000..25fd54dc0a
--- /dev/null
+++ b/test/language/computed-property-names/object/accessor/setter-super.js
@@ -0,0 +1,35 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    computed property setters can call super methods
+---*/
+
+function ID(x) {
+  return x;
+}
+
+var value;
+var proto = {
+  m(name, v) {
+    value = name + ' ' + v;
+  }
+};
+var object = {
+  set ['a'](v) { super.m('a', v); },
+  set [ID('b')](v) { super.m('b', v); },
+  set [0](v) { super.m('0', v); },
+  set [ID(1)](v) { super.m('1', v); },
+};
+
+Object.setPrototypeOf(object, proto);
+
+object.a = 2;
+assert.sameValue(value, 'a 2');
+object.b = 3;
+assert.sameValue(value, 'b 3');
+object[0] = 4;
+assert.sameValue(value, '0 4');
+object[1] = 5;
+assert.sameValue(value, '1 5');
diff --git a/test/language/computed-property-names/object/accessor/setter.js b/test/language/computed-property-names/object/accessor/setter.js
new file mode 100644
index 0000000000..3aed7b6051
--- /dev/null
+++ b/test/language/computed-property-names/object/accessor/setter.js
@@ -0,0 +1,55 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    In an object, duplicate computed property getter names produce only a single property of
+    that name, whose value is the value of the last property of that name.
+---*/
+var calls = 0;
+var object = {
+  set ['a'](_) {
+    calls++;
+  }
+};
+object.a = 'A';
+assert.sameValue(calls, 1);
+
+calls = 0;
+object = {
+  set b(_) {
+    assert(false);
+  },
+  set ['b'](_) {
+    calls++;
+  }
+};
+object.b = 'B';
+assert.sameValue(calls, 1);
+
+calls = 0;
+object = {
+  set c(_) {
+    assert(false)
+  },
+  set ['c'](_) {
+    assert(false)
+  },
+  set ['c'](_) {
+    calls++
+  }
+};
+object.c = 'C';
+assert.sameValue(calls, 1);
+
+calls = 0;
+object = {
+  set ['d'](_) {
+    assert(false)
+  },
+  set d(_) {
+    calls++
+  }
+};
+object.d = 'D';
+assert.sameValue(calls, 1);
diff --git a/test/language/computed-property-names/object/method/generator.js b/test/language/computed-property-names/object/method/generator.js
new file mode 100644
index 0000000000..35d0d53fe3
--- /dev/null
+++ b/test/language/computed-property-names/object/method/generator.js
@@ -0,0 +1,15 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    computed property names can be used as the name of a generator method in an object
+includes: [compareArray.js]
+---*/
+var object = {
+  *['a']() {
+    yield 1;
+    yield 2;
+  }
+};
+assert(compareArray(Object.keys(object), ['a']));
diff --git a/test/language/computed-property-names/object/method/number.js b/test/language/computed-property-names/object/method/number.js
new file mode 100644
index 0000000000..cd1c658219
--- /dev/null
+++ b/test/language/computed-property-names/object/method/number.js
@@ -0,0 +1,24 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    computed property method names can be a number
+includes: [compareArray.js]
+---*/
+
+function ID(x) {
+  return x;
+}
+
+var object = {
+  a() { return 'A'; },
+  [1]() { return 'B'; },
+  c() { return 'C'; },
+  [ID(2)]() { return 'D'; },
+};
+assert.sameValue(object.a(), 'A');
+assert.sameValue(object[1](), 'B');
+assert.sameValue(object.c(), 'C');
+assert.sameValue(object[2](), 'D');
+assert(compareArray(Object.keys(object), ['1', '2', 'a', 'c']));
diff --git a/test/language/computed-property-names/object/method/string.js b/test/language/computed-property-names/object/method/string.js
new file mode 100644
index 0000000000..0a6bc55ba4
--- /dev/null
+++ b/test/language/computed-property-names/object/method/string.js
@@ -0,0 +1,24 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    computed property method names can be a string
+includes: [compareArray.js]
+---*/
+
+function ID(x) {
+  return x;
+}
+
+var object = {
+  a() { return 'A'},
+  ['b']() { return 'B'; },
+  c() { return 'C'; },
+  [ID('d')]() { return 'D'; },
+};
+assert.sameValue(object.a(), 'A');
+assert.sameValue(object.b(), 'B');
+assert.sameValue(object.c(), 'C');
+assert.sameValue(object.d(), 'D');
+assert(compareArray(Object.keys(object), ['a', 'b', 'c', 'd']));
diff --git a/test/language/computed-property-names/object/method/super.js b/test/language/computed-property-names/object/method/super.js
new file mode 100644
index 0000000000..dd71af7f01
--- /dev/null
+++ b/test/language/computed-property-names/object/method/super.js
@@ -0,0 +1,30 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    computed property methods can call super methods
+---*/
+
+function ID(x) {
+  return x;
+}
+
+var proto = {
+  m() {
+    return ' proto m';
+  }
+};
+var object = {
+  ['a']() { return 'a' + super.m(); },
+  [ID('b')]() { return 'b' + super.m(); },
+  [0]() { return '0' + super.m(); },
+  [ID(1)]() { return '1' + super.m(); },
+};
+
+Object.setPrototypeOf(object, proto);
+
+assert.sameValue(object.a(), 'a proto m');
+assert.sameValue(object.b(), 'b proto m');
+assert.sameValue(object[0](), '0 proto m');
+assert.sameValue(object[1](), '1 proto m');
diff --git a/test/language/computed-property-names/object/method/symbol.js b/test/language/computed-property-names/object/method/symbol.js
new file mode 100644
index 0000000000..136904ce14
--- /dev/null
+++ b/test/language/computed-property-names/object/method/symbol.js
@@ -0,0 +1,41 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    computed property method names can be a symbol
+includes: [compareArray.js]
+---*/
+
+function ID(x) {
+  return x;
+}
+
+var sym1 = Symbol();
+var sym2 = Symbol();
+var object = {
+  a() { return 'A'; },
+  [sym1]() { return 'B'; },
+  c() { return 'C'; },
+  [ID(sym2)]() { return 'D'; },
+};
+assert.sameValue(object.a(), 'A');
+assert.sameValue(object[sym1](), 'B');
+assert.sameValue(object.c(), 'C');
+assert.sameValue(object[sym2](), 'D');
+assert(compareArray(Object.keys(object), ['a', 'c']));
+
+// compareArray expects arguments to be sorted,
+// which will cause an array containing symbols to
+// throw an exception when toString() is called.
+//
+// Since there is no guarantee of order:
+//
+//    - Assert only that the symbol is present
+//    - Assert that the length is correct
+//
+var symbols = Object.getOwnPropertySymbols(object);
+
+assert(symbols.indexOf(sym1) !== -1);
+assert(symbols.indexOf(sym2) !== -1);
+assert.sameValue(symbols.length, 2);
diff --git a/test/language/computed-property-names/to-name-side-effects/class.js b/test/language/computed-property-names/to-name-side-effects/class.js
new file mode 100644
index 0000000000..5336b67ff1
--- /dev/null
+++ b/test/language/computed-property-names/to-name-side-effects/class.js
@@ -0,0 +1,34 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    to name, accessor side effects 3
+includes: [compareArray.js]
+---*/
+var counter = 0;
+var key1 = {
+  toString: function() {
+    assert.sameValue(counter++, 0);
+    return 'b';
+  }
+};
+var key2 = {
+  toString: function() {
+    assert.sameValue(counter++, 1);
+    return 'd';
+  }
+};
+class C {
+  a() { return 'A'; }
+  [key1]() { return 'B'; }
+  c() { return 'C'; }
+  [key2]() { return 'D'; }
+}
+assert.sameValue(counter, 2);
+assert.sameValue(new C().a(), 'A');
+assert.sameValue(new C().b(), 'B');
+assert.sameValue(new C().c(), 'C');
+assert.sameValue(new C().d(), 'D');
+assert(compareArray(Object.keys(C.prototype), []));
+assert(compareArray(Object.getOwnPropertyNames(C.prototype), ['constructor', 'a', 'b', 'c', 'd']));
diff --git a/test/language/computed-property-names/to-name-side-effects/numbers-class.js b/test/language/computed-property-names/to-name-side-effects/numbers-class.js
new file mode 100644
index 0000000000..1a9f6d1dff
--- /dev/null
+++ b/test/language/computed-property-names/to-name-side-effects/numbers-class.js
@@ -0,0 +1,37 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    to name, accessor side effects numbers 2
+includes: [compareArray.js]
+---*/
+var counter = 0;
+var key1 = {
+  valueOf: function() {
+    assert.sameValue(counter++, 0);
+    return 1;
+  },
+  toString: null
+};
+var key2 = {
+  valueOf: function() {
+    assert.sameValue(counter++, 1);
+    return 2;
+  },
+  toString: null
+};
+
+class C {
+  a() { return 'A'; }
+  [key1]() { return 'B'; }
+  c() { return 'C'; }
+  [key2]() { return 'D'; }
+}
+assert.sameValue(counter, 2);
+assert.sameValue(new C().a(), 'A');
+assert.sameValue(new C()[1](), 'B');
+assert.sameValue(new C().c(), 'C');
+assert.sameValue(new C()[2](), 'D');
+assert(compareArray(Object.keys(C.prototype), []));
+assert(compareArray(Object.getOwnPropertyNames(C.prototype), ['1', '2', 'constructor', 'a', 'c']));
diff --git a/test/language/computed-property-names/to-name-side-effects/numbers-object.js b/test/language/computed-property-names/to-name-side-effects/numbers-object.js
new file mode 100644
index 0000000000..1ea795e5c7
--- /dev/null
+++ b/test/language/computed-property-names/to-name-side-effects/numbers-object.js
@@ -0,0 +1,36 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    to name side effects numbers
+includes: [compareArray.js]
+---*/
+var counter = 0;
+var key1 = {
+  valueOf: function() {
+    assert.sameValue(counter++, 0);
+    return 1;
+  },
+  toString: null
+};
+var key2 = {
+  valueOf: function() {
+    assert.sameValue(counter++, 1);
+    return 2;
+  },
+  toString: null
+};
+
+var object = {
+  a: 'A',
+  [key1]: 'B',
+  c: 'C',
+  [key2]: 'D',
+};
+assert.sameValue(counter, 2);
+assert.sameValue(object.a, 'A');
+assert.sameValue(object[1], 'B');
+assert.sameValue(object.c, 'C');
+assert.sameValue(object[2], 'D');
+assert(compareArray(Object.keys(object), ['1', '2', 'a', 'c']));
diff --git a/test/language/computed-property-names/to-name-side-effects/object.js b/test/language/computed-property-names/to-name-side-effects/object.js
new file mode 100644
index 0000000000..c5baf406af
--- /dev/null
+++ b/test/language/computed-property-names/to-name-side-effects/object.js
@@ -0,0 +1,33 @@
+// Copyright (C) Copyright 2014 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 12.2.5
+description: >
+    to name, accessor side effects object literal
+includes: [compareArray.js]
+---*/
+var counter = 0;
+var key1 = {
+  toString: function() {
+    assert.sameValue(counter++, 0);
+    return 'b';
+  }
+};
+var key2 = {
+  toString: function() {
+    assert.sameValue(counter++, 1);
+    return 'd';
+  }
+};
+var object = {
+  a() { return 'A'; },
+  [key1]() { return 'B'; },
+  c() { return 'C'; },
+  [key2]() { return 'D'; },
+};
+assert.sameValue(counter, 2);
+assert.sameValue(object.a(), 'A');
+assert.sameValue(object.b(), 'B');
+assert.sameValue(object.c(), 'C');
+assert.sameValue(object.d(), 'D');
+assert(compareArray(Object.keys(object), ['a', 'b', 'c', 'd']));
-- 
GitLab