| Tests for ES6 class name semantics in class statements and expressions |
| |
| On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". |
| |
| |
| Class statement |
| PASS A:::ReferenceError: Can't find variable: A |
| PASS 'use strict'; A:::ReferenceError: Can't find variable: A |
| PASS class {}:::SyntaxError: Class statements must have a name. |
| PASS 'use strict'; class {}:::SyntaxError: Class statements must have a name. |
| PASS class { constructor() {} }:::SyntaxError: Class statements must have a name. |
| PASS 'use strict'; class { constructor() {} }:::SyntaxError: Class statements must have a name. |
| PASS class A { constructor() {} } |
| PASS 'use strict'; class A { constructor() {} } |
| PASS class A { constructor() {} }; A.toString():::'class A { constructor() {} }' |
| PASS 'use strict'; class A { constructor() {} }; A.toString():::'class A { constructor() {} }' |
| PASS class A { constructor() {} }; (new A) instanceof A |
| PASS 'use strict'; class A { constructor() {} }; (new A) instanceof A |
| PASS class A { constructor() { this.base = A; } }; (new A).base.toString():::'class A { constructor() { this.base = A; } }' |
| PASS 'use strict'; class A { constructor() { this.base = A; } }; (new A).base.toString():::'class A { constructor() { this.base = A; } }' |
| PASS class A { constructor() {} }; class B extends A {}; |
| PASS 'use strict'; class A { constructor() {} }; class B extends A {}; |
| PASS class A { constructor() {} }; class B extends A { constructor() {} }; B.toString():::'class B extends A { constructor() {} }' |
| PASS 'use strict'; class A { constructor() {} }; class B extends A { constructor() {} }; B.toString():::'class B extends A { constructor() {} }' |
| PASS class A { constructor() {} }; class B extends A {}; (new B) instanceof A |
| PASS 'use strict'; class A { constructor() {} }; class B extends A {}; (new B) instanceof A |
| PASS class A { constructor() {} }; class B extends A {}; (new B) instanceof B |
| PASS 'use strict'; class A { constructor() {} }; class B extends A {}; (new B) instanceof B |
| PASS class A { constructor() {} }; class B extends A { constructor() { super(); this.base = A; this.derived = B; } }; (new B).base.toString():::'class A { constructor() {} }' |
| PASS 'use strict'; class A { constructor() {} }; class B extends A { constructor() { super(); this.base = A; this.derived = B; } }; (new B).base.toString():::'class A { constructor() {} }' |
| PASS class A { constructor() {} }; class B extends A { constructor() { super(); this.base = A; this.derived = B; } }; (new B).derived.toString():::'class B extends A { constructor() { super(); this.base = A; this.derived = B; } }' |
| PASS 'use strict'; class A { constructor() {} }; class B extends A { constructor() { super(); this.base = A; this.derived = B; } }; (new B).derived.toString():::'class B extends A { constructor() { super(); this.base = A; this.derived = B; } }' |
| |
| Class expression |
| PASS A:::ReferenceError: Can't find variable: A |
| PASS 'use strict'; A:::ReferenceError: Can't find variable: A |
| PASS (class {}) |
| PASS 'use strict'; (class {}) |
| PASS (class { constructor(){} }) |
| PASS 'use strict'; (class { constructor(){} }) |
| PASS typeof (class {}):::"function" |
| PASS 'use strict'; typeof (class {}):::"function" |
| PASS (class A {}) |
| PASS 'use strict'; (class A {}) |
| PASS typeof (class A {}):::"function" |
| PASS 'use strict'; typeof (class A {}):::"function" |
| PASS (class A {}); A:::ReferenceError: Can't find variable: A |
| PASS 'use strict'; (class A {}); A:::ReferenceError: Can't find variable: A |
| PASS new (class A {}) |
| PASS 'use strict'; new (class A {}) |
| PASS typeof (new (class A {})):::"object" |
| PASS 'use strict'; typeof (new (class A {})):::"object" |
| PASS (new (class A { constructor() { this.base = A; } })).base |
| PASS 'use strict'; (new (class A { constructor() { this.base = A; } })).base |
| PASS (new (class A { constructor() { this.base = A; } })).base.toString():::"class A { constructor() { this.base = A; } }" |
| PASS 'use strict'; (new (class A { constructor() { this.base = A; } })).base.toString():::"class A { constructor() { this.base = A; } }" |
| PASS class A {}; (class B extends A {}) |
| PASS 'use strict'; class A {}; (class B extends A {}) |
| PASS class A {}; (class B extends A {}); B:::ReferenceError: Can't find variable: B |
| PASS 'use strict'; class A {}; (class B extends A {}); B:::ReferenceError: Can't find variable: B |
| PASS class A {}; new (class B extends A {}) |
| PASS 'use strict'; class A {}; new (class B extends A {}) |
| PASS class A {}; new (class B extends A { constructor() { super(); this.base = A; this.derived = B; } }) |
| PASS 'use strict'; class A {}; new (class B extends A { constructor() { super(); this.base = A; this.derived = B; } }) |
| PASS class A {}; (new (class B extends A { constructor() { super(); this.base = A; this.derived = B; } })) instanceof A |
| PASS 'use strict'; class A {}; (new (class B extends A { constructor() { super(); this.base = A; this.derived = B; } })) instanceof A |
| PASS class A { constructor() {} }; (new (class B extends A { constructor() { super(); this.base = A; this.derived = B; } })).base.toString():::'class A { constructor() {} }' |
| PASS 'use strict'; class A { constructor() {} }; (new (class B extends A { constructor() { super(); this.base = A; this.derived = B; } })).base.toString():::'class A { constructor() {} }' |
| PASS class A { constructor() {} }; (new (class B extends A { constructor() { super(); this.base = A; this.derived = B; } })).derived.toString():::'class B extends A { constructor() { super(); this.base = A; this.derived = B; } }' |
| PASS 'use strict'; class A { constructor() {} }; (new (class B extends A { constructor() { super(); this.base = A; this.derived = B; } })).derived.toString():::'class B extends A { constructor() { super(); this.base = A; this.derived = B; } }' |
| |
| Class expression assignment to variable |
| PASS A:::ReferenceError: Can't find variable: A |
| PASS 'use strict'; A:::ReferenceError: Can't find variable: A |
| PASS var VarA = class {} |
| PASS 'use strict'; var VarA = class {} |
| PASS var VarA = class { constructor() {} }; VarA.toString():::'class { constructor() {} }' |
| PASS 'use strict'; var VarA = class { constructor() {} }; VarA.toString():::'class { constructor() {} }' |
| PASS VarA:::ReferenceError: Can't find variable: VarA |
| PASS 'use strict'; VarA:::ReferenceError: Can't find variable: VarA |
| PASS var VarA = class A { constructor() {} } |
| PASS 'use strict'; var VarA = class A { constructor() {} } |
| PASS var VarA = class A { constructor() {} }; VarA.toString():::'class A { constructor() {} }' |
| PASS 'use strict'; var VarA = class A { constructor() {} }; VarA.toString():::'class A { constructor() {} }' |
| PASS var VarA = class A { constructor() {} }; A.toString():::ReferenceError: Can't find variable: A |
| PASS 'use strict'; var VarA = class A { constructor() {} }; A.toString():::ReferenceError: Can't find variable: A |
| PASS var VarA = class A { constructor() {} }; (new VarA) instanceof VarA |
| PASS 'use strict'; var VarA = class A { constructor() {} }; (new VarA) instanceof VarA |
| PASS var VarA = class A { constructor() { this.base = A; } }; (new VarA).base.toString():::'class A { constructor() { this.base = A; } }' |
| PASS 'use strict'; var VarA = class A { constructor() { this.base = A; } }; (new VarA).base.toString():::'class A { constructor() { this.base = A; } }' |
| PASS var VarA = class A { constructor() {} }; var VarB = class B extends VarA { constructor() {} }; |
| PASS 'use strict'; var VarA = class A { constructor() {} }; var VarB = class B extends VarA { constructor() {} }; |
| PASS var VarA = class A { constructor() {} }; var VarB = class B extends VarA { constructor() {} }; B:::ReferenceError: Can't find variable: B |
| PASS 'use strict'; var VarA = class A { constructor() {} }; var VarB = class B extends VarA { constructor() {} }; B:::ReferenceError: Can't find variable: B |
| PASS var VarA = class A { constructor() {} }; var VarB = class B extends VarA { constructor() {} }; VarB.toString():::'class B extends VarA { constructor() {} }' |
| PASS 'use strict'; var VarA = class A { constructor() {} }; var VarB = class B extends VarA { constructor() {} }; VarB.toString():::'class B extends VarA { constructor() {} }' |
| PASS var VarA = class A { constructor() {} }; var VarB = class B extends VarA { }; (new VarB) instanceof VarA |
| PASS 'use strict'; var VarA = class A { constructor() {} }; var VarB = class B extends VarA { }; (new VarB) instanceof VarA |
| PASS var VarA = class A { constructor() {} }; var VarB = class B extends VarA { }; (new VarB) instanceof VarB |
| PASS 'use strict'; var VarA = class A { constructor() {} }; var VarB = class B extends VarA { }; (new VarB) instanceof VarB |
| PASS var VarA = class A { constructor() {} }; var VarB = class B extends VarA { constructor() { super(); this.base = VarA; this.derived = B; this.derivedVar = VarB; } }; (new VarB).base === VarA |
| PASS 'use strict'; var VarA = class A { constructor() {} }; var VarB = class B extends VarA { constructor() { super(); this.base = VarA; this.derived = B; this.derivedVar = VarB; } }; (new VarB).base === VarA |
| PASS var VarA = class A { constructor() {} }; var VarB = class B extends VarA { constructor() { super(); this.base = VarA; this.derived = B; this.derivedVar = VarB; } }; (new VarB).derived === VarB |
| PASS 'use strict'; var VarA = class A { constructor() {} }; var VarB = class B extends VarA { constructor() { super(); this.base = VarA; this.derived = B; this.derivedVar = VarB; } }; (new VarB).derived === VarB |
| PASS var VarA = class A { constructor() {} }; var VarB = class B extends VarA { constructor() { super(); this.base = VarA; this.derived = B; this.derivedVar = VarB; } }; (new VarB).derivedVar === VarB |
| PASS 'use strict'; var VarA = class A { constructor() {} }; var VarB = class B extends VarA { constructor() { super(); this.base = VarA; this.derived = B; this.derivedVar = VarB; } }; (new VarB).derivedVar === VarB |
| |
| Class statement binding in other circumstances |
| PASS var result = A; result:::ReferenceError: Can't find variable: A |
| PASS 'use strict'; var result = A; result:::ReferenceError: Can't find variable: A |
| PASS var result = A; class A {}; result:::ReferenceError: Cannot access uninitialized variable. |
| PASS 'use strict'; var result = A; class A {}; result:::ReferenceError: Cannot access uninitialized variable. |
| PASS class A { constructor() { A = 1; } }; new A:::TypeError: Attempted to assign to readonly property. |
| PASS 'use strict'; class A { constructor() { A = 1; } }; new A:::TypeError: Attempted to assign to readonly property. |
| PASS class A { constructor() { } }; A = 1; A:::1 |
| PASS 'use strict'; class A { constructor() { } }; A = 1; A:::1 |
| PASS class A {}; var result = A; result |
| PASS 'use strict'; class A {}; var result = A; result |
| PASS eval('var Foo = 10'); Foo:::10 |
| PASS 'use strict'; eval('var Foo = 10'); Foo:::ReferenceError: Can't find variable: Foo |
| PASS eval('class Bar { constructor() {} }; Bar.toString()');:::'class Bar { constructor() {} }' |
| PASS 'use strict'; eval('class Bar { constructor() {} }'); Bar.toString():::ReferenceError: Can't find variable: Bar |
| PASS successfullyParsed |
| |
| TEST COMPLETE |
| |