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 // Flags: --harmony | 5 // Flags: --harmony |
6 | 6 |
7 (function TestBasics() { | 7 (function TestBasics() { |
8 var C = class C {} | 8 var C = class C {} |
9 assertEquals(typeof C, 'function'); | 9 assertEquals(typeof C, 'function'); |
10 assertEquals(C.__proto__, Function.prototype); | 10 assertEquals(C.__proto__, Function.prototype); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 class C { | 158 class C { |
159 constructor() { | 159 constructor() { |
160 assertThrows(function() { | 160 assertThrows(function() { |
161 C = 42; | 161 C = 42; |
162 }, ReferenceError); | 162 }, ReferenceError); |
163 } | 163 } |
164 } | 164 } |
165 new C(); | 165 new C(); |
166 })(); | 166 })(); |
167 */ | 167 */ |
| 168 |
| 169 |
| 170 (function TestToString() { |
| 171 class C {} |
| 172 assertEquals('class C {}', C.toString()); |
| 173 |
| 174 class D { constructor() { 42; } } |
| 175 assertEquals('class D { constructor() { 42; } }', D.toString()); |
| 176 |
| 177 class E { x() { 42; } } |
| 178 assertEquals('class E { x() { 42; } }', E.toString()); |
| 179 })(); |
OLD | NEW |