default-constructor.js (535B)
1 // Copyright (C) 2014 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 es6id: 14.5 5 description: > 6 class default constructor 7 ---*/ 8 var calls = 0; 9 class Base { 10 constructor() { 11 calls++; 12 } 13 } 14 class Derived extends Base {} 15 var object = new Derived(); 16 assert.sameValue(calls, 1, "The value of `calls` is `1`"); 17 18 calls = 0; 19 assert.throws(TypeError, function() { Derived(); }); 20 assert.sameValue(calls, 0, "The value of `calls` is `0`"); 21 22 reportCompare(0, 0);