| OLD | NEW |
| 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 | 7 |
| 8 function ID(x) { | 8 function ID(x) { |
| 9 return x; | 9 return x; |
| 10 } | 10 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 static ['d']() { return 'D'; } | 74 static ['d']() { return 'D'; } |
| 75 } | 75 } |
| 76 assertEquals('A', C.a()); | 76 assertEquals('A', C.a()); |
| 77 assertEquals('B', C.b()); | 77 assertEquals('B', C.b()); |
| 78 assertEquals('C', C.c()); | 78 assertEquals('C', C.c()); |
| 79 assertEquals('D', C.d()); | 79 assertEquals('D', C.d()); |
| 80 assertArrayEquals([], Object.keys(C)); | 80 assertArrayEquals([], Object.keys(C)); |
| 81 // TODO(arv): It is not clear that we are adding the "standard" properties | 81 // TODO(arv): It is not clear that we are adding the "standard" properties |
| 82 // in the right order. As far as I can tell the spec adds them in alphabetical | 82 // in the right order. As far as I can tell the spec adds them in alphabetical |
| 83 // order. | 83 // order. |
| 84 assertArrayEquals(['length', 'name', 'prototype', 'a', 'b', 'c', 'd'], | 84 assertArrayEquals(['length', 'prototype', 'a', 'b', 'c', 'd', 'name'], |
| 85 Object.getOwnPropertyNames(C)); | 85 Object.getOwnPropertyNames(C)); |
| 86 })(); | 86 })(); |
| 87 | 87 |
| 88 | 88 |
| 89 (function TestStaticClassMethodNumber() { | 89 (function TestStaticClassMethodNumber() { |
| 90 class C { | 90 class C { |
| 91 static a() { return 'A'; } | 91 static a() { return 'A'; } |
| 92 static [1]() { return 'B'; } | 92 static [1]() { return 'B'; } |
| 93 static c() { return 'C'; } | 93 static c() { return 'C'; } |
| 94 static [2]() { return 'D'; } | 94 static [2]() { return 'D'; } |
| 95 } | 95 } |
| 96 assertEquals('A', C.a()); | 96 assertEquals('A', C.a()); |
| 97 assertEquals('B', C[1]()); | 97 assertEquals('B', C[1]()); |
| 98 assertEquals('C', C.c()); | 98 assertEquals('C', C.c()); |
| 99 assertEquals('D', C[2]()); | 99 assertEquals('D', C[2]()); |
| 100 // Array indexes first. | 100 // Array indexes first. |
| 101 assertArrayEquals([], Object.keys(C)); | 101 assertArrayEquals([], Object.keys(C)); |
| 102 assertArrayEquals(['1', '2', 'length', 'name', 'prototype', 'a', 'c'], | 102 assertArrayEquals(['1', '2', 'length', 'prototype', 'a', 'c', 'name'], |
| 103 Object.getOwnPropertyNames(C)); | 103 Object.getOwnPropertyNames(C)); |
| 104 })(); | 104 })(); |
| 105 | 105 |
| 106 | 106 |
| 107 (function TestStaticClassMethodSymbol() { | 107 (function TestStaticClassMethodSymbol() { |
| 108 var sym1 = Symbol(); | 108 var sym1 = Symbol(); |
| 109 var sym2 = Symbol(); | 109 var sym2 = Symbol(); |
| 110 class C { | 110 class C { |
| 111 static a() { return 'A'; } | 111 static a() { return 'A'; } |
| 112 static [sym1]() { return 'B'; } | 112 static [sym1]() { return 'B'; } |
| 113 static c() { return 'C'; } | 113 static c() { return 'C'; } |
| 114 static [sym2]() { return 'D'; } | 114 static [sym2]() { return 'D'; } |
| 115 } | 115 } |
| 116 assertEquals('A', C.a()); | 116 assertEquals('A', C.a()); |
| 117 assertEquals('B', C[sym1]()); | 117 assertEquals('B', C[sym1]()); |
| 118 assertEquals('C', C.c()); | 118 assertEquals('C', C.c()); |
| 119 assertEquals('D', C[sym2]()); | 119 assertEquals('D', C[sym2]()); |
| 120 assertArrayEquals([], Object.keys(C)); | 120 assertArrayEquals([], Object.keys(C)); |
| 121 assertArrayEquals(['length', 'name', 'prototype', 'a', 'c'], | 121 assertArrayEquals(['length', 'prototype', 'a', 'c', 'name'], |
| 122 Object.getOwnPropertyNames(C)); | 122 Object.getOwnPropertyNames(C)); |
| 123 assertArrayEquals([sym1, sym2], Object.getOwnPropertySymbols(C)); | 123 assertArrayEquals([sym1, sym2], Object.getOwnPropertySymbols(C)); |
| 124 })(); | 124 })(); |
| 125 | 125 |
| 126 | 126 |
| 127 | 127 |
| 128 function assertIteratorResult(value, done, result) { | 128 function assertIteratorResult(value, done, result) { |
| 129 assertEquals({ value: value, done: done}, result); | 129 assertEquals({ value: value, done: done}, result); |
| 130 } | 130 } |
| 131 | 131 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 class C { | 452 class C { |
| 453 get [C]() { return 42; } | 453 get [C]() { return 42; } |
| 454 } | 454 } |
| 455 }, ReferenceError); | 455 }, ReferenceError); |
| 456 assertThrows(function() { | 456 assertThrows(function() { |
| 457 class C { | 457 class C { |
| 458 set [C](_) { } | 458 set [C](_) { } |
| 459 } | 459 } |
| 460 }, ReferenceError); | 460 }, ReferenceError); |
| 461 })(); | 461 })(); |
| OLD | NEW |