blob: cd09e6a0103d0fc3542102ad7379d51d61072da1 [file] [log] [blame]
Tests for ES6 class syntax expressions
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS constructorCallCount is 0
PASS A.someStaticMethod() is staticMethodValue
PASS A.someStaticGetter is getterValue
PASS setterValue = undefined; A.someStaticSetter = 123; setterValue is 123
PASS (new A).someInstanceMethod() is instanceMethodValue
PASS constructorCallCount is 1
PASS (new A).someGetter is getterValue
PASS constructorCallCount is 2
PASS (new A).someGetter is getterValue
PASS setterValue = undefined; (new A).someSetter = 789; setterValue is 789
PASS (new A).__proto__ is A.prototype
PASS A.prototype.constructor is A
PASS x = class threw exception SyntaxError: Unexpected end of script.
PASS x = class { threw exception SyntaxError: Unexpected end of script.
PASS x = class { ( } threw exception SyntaxError: Unexpected token '('.
PASS x = class {} did not throw exception.
PASS x = class { constructor() {} constructor() {} } threw exception SyntaxError: Cannot declare multiple constructors in a single class..
PASS x = class { get constructor() {} } threw exception SyntaxError: Cannot declare a getter or setter named 'constructor'..
PASS x = class { set constructor() {} } threw exception SyntaxError: Cannot declare a getter or setter named 'constructor'..
PASS x = class { constructor() {} static constructor() { return staticMethodValue; } } did not throw exception.
PASS x = class { constructor() {} static constructor() { return staticMethodValue; } }; x.constructor() is staticMethodValue
PASS x = class { constructor() {} static prototype() {} } threw exception SyntaxError: Cannot declare a static method named 'prototype'..
PASS x = class { constructor() {} static get prototype() {} } threw exception SyntaxError: Cannot declare a static method named 'prototype'..
PASS x = class { constructor() {} static set prototype() {} } threw exception SyntaxError: Cannot declare a static method named 'prototype'..
PASS x = class { constructor() {} prototype() { return instanceMethodValue; } } did not throw exception.
PASS x = class { constructor() {} prototype() { return instanceMethodValue; } }; (new x).prototype() is instanceMethodValue
PASS x = class { constructor() {} set foo(a) {} } did not throw exception.
PASS x = class { constructor() {} set foo({x, y}) {} } did not throw exception.
PASS x = class { constructor() {} set foo() {} } threw exception SyntaxError: Unexpected token ')'. setter functions must have one parameter..
PASS x = class { constructor() {} set foo(a, b) {} } threw exception SyntaxError: Unexpected token ','. setter functions must have one parameter..
PASS x = class { constructor() {} get foo() {} } did not throw exception.
PASS x = class { constructor() {} get foo(x) {} } threw exception SyntaxError: Unexpected identifier 'x'. getter functions must have no parameters..
PASS x = class { constructor() {} get foo({x, y}) {} } threw exception SyntaxError: Unexpected token '{'. getter functions must have no parameters..
PASS successfullyParsed is true
TEST COMPLETE