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

calls = 0;
assert.throws(TypeError, function() { Derived(); });
assert.sameValue(calls, 0, "The value of `calls` is `0`");

reportCompare(0, 0);