Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: test/mjsunit/harmony/computed-property-names.js

Issue 807033003: Revert of ES6 computed property names (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/mjsunit/harmony/computed-property-names-classes.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/computed-property-names.js
diff --git a/test/mjsunit/harmony/computed-property-names.js b/test/mjsunit/harmony/computed-property-names.js
deleted file mode 100644
index 36ce6754d598b28f979f86e305bfd896bf901ff8..0000000000000000000000000000000000000000
--- a/test/mjsunit/harmony/computed-property-names.js
+++ /dev/null
@@ -1,270 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Flags: --harmony-computed-property-names
-
-
-function ID(x) {
- return x;
-}
-
-
-
-(function TestBasicsString() {
- var object = {
- a: 'A',
- ['b']: 'B',
- c: 'C',
- [ID('d')]: 'D',
- };
- assertEquals('A', object.a);
- assertEquals('B', object.b);
- assertEquals('C', object.c);
- assertEquals('D', object.d);
- assertArrayEquals(['a', 'b', 'c', 'd'], Object.keys(object));
-})();
-
-
-(function TestBasicsNumber() {
- var object = {
- a: 'A',
- [1]: 'B',
- c: 'C',
- [ID(2)]: 'D',
- };
- assertEquals('A', object.a);
- assertEquals('B', object[1]);
- assertEquals('C', object.c);
- assertEquals('D', object[2]);
- // Array indexes first.
- assertArrayEquals(['1', '2', 'a', 'c'], Object.keys(object));
-})();
-
-
-(function TestBasicsSymbol() {
- var sym1 = Symbol();
- var sym2 = Symbol();
- var object = {
- a: 'A',
- [sym1]: 'B',
- c: 'C',
- [ID(sym2)]: 'D',
- };
- assertEquals('A', object.a);
- assertEquals('B', object[sym1]);
- assertEquals('C', object.c);
- assertEquals('D', object[sym2]);
- assertArrayEquals(['a', 'c'], Object.keys(object));
- assertArrayEquals([sym1, sym2], Object.getOwnPropertySymbols(object));
-})();
-
-
-(function TestToNameSideEffects() {
- var counter = 0;
- var key1 = {
- toString: function() {
- assertEquals(0, counter++);
- return 'b';
- }
- };
- var key2 = {
- toString: function() {
- assertEquals(1, counter++);
- return 'd';
- }
- };
- var object = {
- a: 'A',
- [key1]: 'B',
- c: 'C',
- [key2]: 'D',
- };
- assertEquals(2, counter);
- assertEquals('A', object.a);
- assertEquals('B', object.b);
- assertEquals('C', object.c);
- assertEquals('D', object.d);
- assertArrayEquals(['a', 'b', 'c', 'd'], Object.keys(object));
-})();
-
-
-(function TestToNameSideEffectsNumbers() {
- var counter = 0;
- var key1 = {
- valueOf: function() {
- assertEquals(0, counter++);
- return 1;
- },
- toString: null
- };
- var key2 = {
- valueOf: function() {
- assertEquals(1, counter++);
- return 2;
- },
- toString: null
- };
-
- var object = {
- a: 'A',
- [key1]: 'B',
- c: 'C',
- [key2]: 'D',
- };
- assertEquals(2, counter);
- assertEquals('A', object.a);
- assertEquals('B', object[1]);
- assertEquals('C', object.c);
- assertEquals('D', object[2]);
- // Array indexes first.
- assertArrayEquals(['1', '2', 'a', 'c'], Object.keys(object));
-})();
-
-
-(function TestDoubleName() {
- var object = {
- [1.2]: 'A',
- [1e55]: 'B',
- [0.000001]: 'C',
- [-0]: 'D',
- [Infinity]: 'E',
- [-Infinity]: 'F',
- [NaN]: 'G',
- };
- assertEquals('A', object['1.2']);
- assertEquals('B', object['1e+55']);
- assertEquals('C', object['0.000001']);
- assertEquals('D', object[0]);
- assertEquals('E', object[Infinity]);
- assertEquals('F', object[-Infinity]);
- assertEquals('G', object[NaN]);
-})();
-
-
-(function TestGetter() {
- var object = {
- get ['a']() {
- return 'A';
- }
- };
- assertEquals('A', object.a);
-
- object = {
- get b() {
- assertUnreachable();
- },
- get ['b']() {
- return 'B';
- }
- };
- assertEquals('B', object.b);
-
- object = {
- get c() {
- assertUnreachable();
- },
- get ['c']() {
- assertUnreachable();
- },
- get ['c']() {
- return 'C';
- }
- };
- assertEquals('C', object.c);
-
- object = {
- get ['d']() {
- assertUnreachable();
- },
- get d() {
- return 'D';
- }
- };
- assertEquals('D', object.d);
-})();
-
-
-(function TestSetter() {
- var calls = 0;
- var object = {
- set ['a'](_) {
- calls++;
- }
- };
- object.a = 'A';
- assertEquals(1, calls);
-
- calls = 0;
- object = {
- set b(_) {
- assertUnreachable();
- },
- set ['b'](_) {
- calls++;
- }
- };
- object.b = 'B';
- assertEquals(1, calls);
-
- calls = 0;
- object = {
- set c(_) {
- assertUnreachable()
- },
- set ['c'](_) {
- assertUnreachable()
- },
- set ['c'](_) {
- calls++
- }
- };
- object.c = 'C';
- assertEquals(1, calls);
-
- calls = 0;
- object = {
- set ['d'](_) {
- assertUnreachable()
- },
- set d(_) {
- calls++
- }
- };
- object.d = 'D';
- assertEquals(1, calls);
-})();
-
-
-(function TestDuplicateKeys() {
- 'use strict';
- // ES5 does not allow duplicate keys.
- // ES6 does but we haven't changed our code yet.
-
- var object = {
- a: 1,
- ['a']: 2,
- };
- assertEquals(2, object.a);
-})();
-
-
-(function TestProto() {
- var proto = {};
- var object = {
- __proto__: proto
- };
- assertEquals(proto, Object.getPrototypeOf(object));
-
- object = {
- '__proto__': proto
- };
- assertEquals(proto, Object.getPrototypeOf(object));
-
- var object = {
- ['__proto__']: proto
- };
- assertEquals(Object.prototype, Object.getPrototypeOf(object));
- assertEquals(proto, object.__proto__);
- assertTrue(object.hasOwnProperty('__proto__'));
-})();
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | test/mjsunit/harmony/computed-property-names-classes.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698