• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Tests for ES6 class syntax expressions
2
3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6PASS constructorCallCount is 0
7PASS A.someStaticMethod() is staticMethodValue
8PASS A.someStaticGetter is getterValue
9PASS setterValue = undefined; A.someStaticSetter = 123; setterValue is 123
10PASS (new A).someInstanceMethod() is instanceMethodValue
11PASS constructorCallCount is 1
12PASS (new A).someGetter is getterValue
13PASS constructorCallCount is 2
14PASS (new A).someGetter is getterValue
15PASS setterValue = undefined; (new A).someSetter = 789; setterValue is 789
16PASS (new A).__proto__ is A.prototype
17PASS A.prototype.constructor is A
18PASS x = class threw exception SyntaxError: Unexpected end of input.
19PASS x = class { threw exception SyntaxError: Unexpected end of input.
20PASS x = class { ( } threw exception SyntaxError: Unexpected token (.
21PASS x = class {} did not throw exception.
22PASS x = class { constructor() {} constructor() {} } threw exception SyntaxError: A class may only have one constructor.
23PASS x = class { get constructor() {} } threw exception SyntaxError: Class constructor may not be an accessor.
24PASS x = class { set constructor() {} } threw exception SyntaxError: Class constructor may not be an accessor.
25PASS x = class { constructor() {} static constructor() { return staticMethodValue; } } did not throw exception.
26PASS x = class { constructor() {} static constructor() { return staticMethodValue; } }; x.constructor() is staticMethodValue
27PASS x = class { constructor() {} static prototype() {} } threw exception SyntaxError: Classes may not have static property named prototype.
28PASS x = class { constructor() {} static get prototype() {} } threw exception SyntaxError: Classes may not have static property named prototype.
29PASS x = class { constructor() {} static set prototype() {} } threw exception SyntaxError: Classes may not have static property named prototype.
30PASS x = class  { constructor() {} prototype() { return instanceMethodValue; } } did not throw exception.
31PASS x = class { constructor() {} prototype() { return instanceMethodValue; } }; (new x).prototype() is instanceMethodValue
32PASS x = class { constructor() {} set foo(a) {} } did not throw exception.
33PASS x = class { constructor() {} set foo({x, y}) {} } did not throw exception.
34PASS x = class { constructor() {} set foo() {} } threw exception SyntaxError: Setter must have exactly one formal parameter..
35PASS x = class { constructor() {} set foo(a, b) {} } threw exception SyntaxError: Setter must have exactly one formal parameter..
36PASS x = class { constructor() {} get foo() {} } did not throw exception.
37PASS x = class { constructor() {} get foo(x) {} } threw exception SyntaxError: Getter must not have any formal parameters..
38PASS x = class { constructor() {} get foo({x, y}) {} } threw exception SyntaxError: Getter must not have any formal parameters..
39PASS successfullyParsed is true
40
41TEST COMPLETE
42