53 lines
3.4 KiB
Plaintext
53 lines
3.4 KiB
Plaintext
Tests for ES6 class syntax declarations
|
|
|
|
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
|
|
|
|
|
|
PASS constructorCallCount:::0
|
|
PASS A.someStaticMethod():::staticMethodValue
|
|
PASS A.someStaticGetter:::getterValue
|
|
PASS setterValue = undefined; A.someStaticSetter = 123; setterValue:::123
|
|
PASS (new A).someInstanceMethod():::instanceMethodValue
|
|
PASS constructorCallCount:::1
|
|
PASS (new A).someGetter:::getterValue
|
|
PASS constructorCallCount:::2
|
|
PASS (new A).someGetter:::getterValue
|
|
PASS setterValue = undefined; (new A).someSetter = 789; setterValue:::789
|
|
PASS (new A).__proto__:::A.prototype
|
|
PASS A.prototype.constructor:::A
|
|
PASS class:::SyntaxError: Unexpected end of script
|
|
PASS class [:::SyntaxError: Unexpected token '['
|
|
PASS class {:::SyntaxError: Class statements must have a name.
|
|
PASS class X {:::SyntaxError: Unexpected end of script
|
|
PASS class X { ( }:::SyntaxError: Unexpected token '('
|
|
PASS class X {}
|
|
PASS class X { constructor() {} constructor() {} }:::SyntaxError: Cannot declare multiple constructors in a single class.
|
|
PASS class X { get constructor() {} }:::SyntaxError: Cannot declare a getter or setter named 'constructor'.
|
|
PASS class X { set constructor() {} }:::SyntaxError: Cannot declare a getter or setter named 'constructor'.
|
|
PASS class X { ['constructor']() {} }
|
|
PASS class X { ['constructor']() { throw 'unreached' } }; new X
|
|
PASS class X { constructor() {} static constructor() { return staticMethodValue; } }
|
|
PASS class X { constructor() {} static constructor() { return staticMethodValue; } }; X.constructor():::staticMethodValue
|
|
PASS class X { constructor() {} static get constructor() { return staticMethodValue; } }
|
|
PASS class X { constructor() {} static get constructor() { return staticMethodValue; } }; X.constructor:::staticMethodValue
|
|
PASS class X { constructor() {} static prototype() {} }:::SyntaxError: Cannot declare a static method named 'prototype'.
|
|
PASS class X { constructor() {} static get prototype() {} }:::SyntaxError: Cannot declare a static method named 'prototype'.
|
|
PASS class X { constructor() {} static set prototype() {} }:::SyntaxError: Cannot declare a static method named 'prototype'.
|
|
PASS class X { constructor() {} static get ['prototype']() {} }:::TypeError: Attempting to change configurable attribute of unconfigurable property.
|
|
PASS class X { constructor() {} static set ['prototype'](x) {} }:::TypeError: Attempting to change configurable attribute of unconfigurable property.
|
|
PASS class X { constructor() {} prototype() { return instanceMethodValue; } }
|
|
PASS class X { constructor() {} get prototype() { return instanceMethodValue; } }
|
|
PASS class X { constructor() {} set prototype(x) { } }
|
|
PASS class X { constructor() {} prototype() { return instanceMethodValue; } }; (new X).prototype():::instanceMethodValue
|
|
PASS class X { constructor() {} set foo(a) {} }
|
|
PASS class X { constructor() {} set foo({x, y}) {} }
|
|
PASS class X { constructor() {} set foo() {} }:::SyntaxError: Unexpected token ')'. setter functions must have one parameter.
|
|
PASS class X { constructor() {} set foo(a, b) {} }:::SyntaxError: Unexpected token ','. setter functions must have one parameter.
|
|
PASS class X { constructor() {} get foo() {} }
|
|
PASS class X { constructor() {} get foo(x) {} }:::SyntaxError: Unexpected identifier 'x'. getter functions must have no parameters.
|
|
PASS class X { constructor() {} get foo({x, y}) {} }:::SyntaxError: Unexpected token '{'. getter functions must have no parameters.
|
|
PASS successfullyParsed:::true
|
|
|
|
TEST COMPLETE
|
|
|