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

Side by Side Diff: test/mjsunit/harmony/computed-property-names-classes.js

Issue 1027283004: [es6] do not add caller/arguments to ES6 function definitions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove unneeded bits Created 5 years, 9 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 // Flags: --harmony-computed-property-names --harmony-classes 7 // Flags: --harmony-computed-property-names --harmony-classes
8 8
9 9
10 function ID(x) { 10 function ID(x) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 static ['d']() { return 'D'; } 76 static ['d']() { return 'D'; }
77 } 77 }
78 assertEquals('A', C.a()); 78 assertEquals('A', C.a());
79 assertEquals('B', C.b()); 79 assertEquals('B', C.b());
80 assertEquals('C', C.c()); 80 assertEquals('C', C.c());
81 assertEquals('D', C.d()); 81 assertEquals('D', C.d());
82 assertArrayEquals([], Object.keys(C)); 82 assertArrayEquals([], Object.keys(C));
83 // TODO(arv): It is not clear that we are adding the "standard" properties 83 // TODO(arv): It is not clear that we are adding the "standard" properties
84 // in the right order. As far as I can tell the spec adds them in alphabetical 84 // in the right order. As far as I can tell the spec adds them in alphabetical
85 // order. 85 // order.
86 assertArrayEquals(['length', 'name', 'arguments', 'caller', 'prototype', 86 assertArrayEquals(['length', 'name', 'prototype',
87 'a', 'b', 'c', 'd'], 87 'a', 'b', 'c', 'd'],
88 Object.getOwnPropertyNames(C)); 88 Object.getOwnPropertyNames(C));
89 })(); 89 })();
90 90
91 91
92 (function TestStaticClassMethodNumber() { 92 (function TestStaticClassMethodNumber() {
93 class C { 93 class C {
94 static a() { return 'A'; } 94 static a() { return 'A'; }
95 static [1]() { return 'B'; } 95 static [1]() { return 'B'; }
96 static c() { return 'C'; } 96 static c() { return 'C'; }
97 static [2]() { return 'D'; } 97 static [2]() { return 'D'; }
98 } 98 }
99 assertEquals('A', C.a()); 99 assertEquals('A', C.a());
100 assertEquals('B', C[1]()); 100 assertEquals('B', C[1]());
101 assertEquals('C', C.c()); 101 assertEquals('C', C.c());
102 assertEquals('D', C[2]()); 102 assertEquals('D', C[2]());
103 // Array indexes first. 103 // Array indexes first.
104 assertArrayEquals([], Object.keys(C)); 104 assertArrayEquals([], Object.keys(C));
105 assertArrayEquals(['1', '2', 'length', 'name', 'arguments', 'caller', 105 assertArrayEquals(['1', '2', 'length', 'name',
106 'prototype', 'a', 'c'], Object.getOwnPropertyNames(C)); 106 'prototype', 'a', 'c'], Object.getOwnPropertyNames(C));
107 })(); 107 })();
108 108
109 109
110 (function TestStaticClassMethodSymbol() { 110 (function TestStaticClassMethodSymbol() {
111 var sym1 = Symbol(); 111 var sym1 = Symbol();
112 var sym2 = Symbol(); 112 var sym2 = Symbol();
113 class C { 113 class C {
114 static a() { return 'A'; } 114 static a() { return 'A'; }
115 static [sym1]() { return 'B'; } 115 static [sym1]() { return 'B'; }
116 static c() { return 'C'; } 116 static c() { return 'C'; }
117 static [sym2]() { return 'D'; } 117 static [sym2]() { return 'D'; }
118 } 118 }
119 assertEquals('A', C.a()); 119 assertEquals('A', C.a());
120 assertEquals('B', C[sym1]()); 120 assertEquals('B', C[sym1]());
121 assertEquals('C', C.c()); 121 assertEquals('C', C.c());
122 assertEquals('D', C[sym2]()); 122 assertEquals('D', C[sym2]());
123 assertArrayEquals([], Object.keys(C)); 123 assertArrayEquals([], Object.keys(C));
124 assertArrayEquals(['length', 'name', 'arguments', 'caller', 'prototype', 124 assertArrayEquals(['length', 'name', 'prototype',
125 'a', 'c'], 125 'a', 'c'],
126 Object.getOwnPropertyNames(C)); 126 Object.getOwnPropertyNames(C));
127 assertArrayEquals([sym1, sym2], Object.getOwnPropertySymbols(C)); 127 assertArrayEquals([sym1, sym2], Object.getOwnPropertySymbols(C));
128 })(); 128 })();
129 129
130 130
131 131
132 function assertIteratorResult(value, done, result) { 132 function assertIteratorResult(value, done, result) {
133 assertEquals({ value: value, done: done}, result); 133 assertEquals({ value: value, done: done}, result);
134 } 134 }
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 class C { 456 class C {
457 get [C]() { return 42; } 457 get [C]() { return 42; }
458 } 458 }
459 }, ReferenceError); 459 }, ReferenceError);
460 assertThrows(function() { 460 assertThrows(function() {
461 class C { 461 class C {
462 set [C](_) { } 462 set [C](_) { }
463 } 463 }
464 }, ReferenceError); 464 }, ReferenceError);
465 })(); 465 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698