OLD | NEW |
1 Tests for ES6 class syntax "extends" | 1 Tests for ES6 class syntax "extends" |
2 | 2 |
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". | 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
". |
4 | 4 |
5 | 5 |
6 PASS (new Base) instanceof Base is true | 6 PASS (new Base) instanceof Base is true |
7 PASS Object.getPrototypeOf(new Base) is Base.prototype | 7 PASS Object.getPrototypeOf(new Base) is Base.prototype |
8 PASS (new Derived) instanceof Derived is true | 8 PASS (new Derived) instanceof Derived is true |
9 PASS Object.getPrototypeOf(new Derived) is Derived.prototype | 9 PASS Object.getPrototypeOf(new Derived) is Derived.prototype |
10 PASS Object.getPrototypeOf(Derived.prototype) is Base.prototype | 10 PASS Object.getPrototypeOf(Derived.prototype) is Base.prototype |
11 PASS (new Derived).baseMethod() is "base" | 11 PASS (new Derived).baseMethod() is "base" |
12 PASS (new Derived).overridenMethod() is "derived" | 12 PASS (new Derived).overridenMethod() is "derived" |
13 PASS Derived.staticBaseMethod() is "base" | 13 PASS Derived.staticBaseMethod() is "base" |
14 PASS Derived.staticOverridenMethod() is "derived" | 14 PASS Derived.staticOverridenMethod() is "derived" |
15 PASS x = class extends threw exception SyntaxError: Unexpected end of input. | 15 PASS x = class extends threw exception SyntaxError: Unexpected end of input. |
16 PASS x = class extends threw exception SyntaxError: Unexpected end of input. | 16 PASS x = class extends threw exception SyntaxError: Unexpected end of input. |
17 PASS x = class extends Base { threw exception SyntaxError: Unexpected end of inp
ut. | 17 PASS x = class extends Base { threw exception SyntaxError: Unexpected end of inp
ut. |
18 PASS x = class extends Base { } did not throw exception. | 18 PASS x = class extends Base { } did not throw exception. |
19 PASS x = class extends Base { constructor() { } } did not throw exception. | 19 PASS x = class extends Base { constructor() { } } did not throw exception. |
20 PASS x.__proto__ is Base | 20 PASS x.__proto__ is Base |
21 PASS Object.getPrototypeOf(x) is Base | 21 PASS Object.getPrototypeOf(x) is Base |
22 PASS x.prototype.__proto__ is Base.prototype | 22 PASS x.prototype.__proto__ is Base.prototype |
23 PASS Object.getPrototypeOf(x.prototype) is Base.prototype | 23 PASS Object.getPrototypeOf(x.prototype) is Base.prototype |
24 PASS x = class extends null { constructor() { } }; x.__proto__ is Function.proto
type | 24 PASS x = class extends null { constructor() { } }; x.__proto__ is Function.proto
type |
25 PASS x.__proto__ is Function.prototype | 25 PASS x.__proto__ is Function.prototype |
26 PASS x = class extends 3 { constructor() { } }; x.__proto__ threw exception Type
Error: Class extends value 3 is not a function or null. | 26 PASS x = class extends 3 { constructor() { } }; x.__proto__ threw exception Type
Error: Class extends value 3 is not a constructor or null. |
27 PASS x = class extends "abc" { constructor() { } }; x.__proto__ threw exception
TypeError: Class extends value abc is not a function or null. | 27 PASS x = class extends "abc" { constructor() { } }; x.__proto__ threw exception
TypeError: Class extends value abc is not a constructor or null. |
28 PASS baseWithBadPrototype = function () {}; baseWithBadPrototype.prototype = 3;
new baseWithBadPrototype did not throw exception. | 28 PASS baseWithBadPrototype = function () {}; baseWithBadPrototype.prototype = 3;
new baseWithBadPrototype did not throw exception. |
29 PASS x = class extends baseWithBadPrototype { constructor() { } } threw exceptio
n TypeError: Class extends value does not have valid prototype property 3. | 29 PASS x = class extends baseWithBadPrototype { constructor() { } } threw exceptio
n TypeError: Class extends value does not have valid prototype property 3. |
30 PASS baseWithBadPrototype.prototype = "abc" did not throw exception. | 30 PASS baseWithBadPrototype.prototype = "abc" did not throw exception. |
31 PASS x = class extends baseWithBadPrototype { constructor() { } } threw exceptio
n TypeError: Class extends value does not have valid prototype property abc. | 31 PASS x = class extends baseWithBadPrototype { constructor() { } } threw exceptio
n TypeError: Class extends value does not have valid prototype property abc. |
32 PASS baseWithBadPrototype.prototype = null; x = class extends baseWithBadPrototy
pe { constructor() { } } did not throw exception. | 32 PASS baseWithBadPrototype.prototype = null; x = class extends baseWithBadPrototy
pe { constructor() { } } did not throw exception. |
33 PASS x = 1; c = class extends ++x { constructor() { } }; threw exception SyntaxE
rror: Unexpected token ++. | 33 PASS x = 1; c = class extends ++x { constructor() { } }; threw exception SyntaxE
rror: Unexpected token ++. |
34 PASS x = 1; c = class extends x++ { constructor() { } }; threw exception SyntaxE
rror: Unexpected token ++. | 34 PASS x = 1; c = class extends x++ { constructor() { } }; threw exception SyntaxE
rror: Unexpected token ++. |
35 PASS x = 1; c = class extends (++x) { constructor() { } }; threw exception TypeE
rror: Class extends value 2 is not a function or null. | 35 PASS x = 1; c = class extends (++x) { constructor() { } }; threw exception TypeE
rror: Class extends value 2 is not a constructor or null. |
36 PASS x = 1; c = class extends (x++) { constructor() { } }; threw exception TypeE
rror: Class extends value 1 is not a function or null. | 36 PASS x = 1; c = class extends (x++) { constructor() { } }; threw exception TypeE
rror: Class extends value 1 is not a constructor or null. |
37 PASS x = 1; try { c = class extends (++x) { constructor() { } } } catch (e) { };
x is 2 | 37 PASS x = 1; try { c = class extends (++x) { constructor() { } } } catch (e) { };
x is 2 |
38 PASS x = 1; try { c = class extends (x++) { constructor() { } } } catch (e) { };
x is 2 | 38 PASS x = 1; try { c = class extends (x++) { constructor() { } } } catch (e) { };
x is 2 |
39 PASS namespace = {}; namespace.A = class { }; namespace.B = class extends namesp
ace.A { } did not throw exception. | 39 PASS namespace = {}; namespace.A = class { }; namespace.B = class extends namesp
ace.A { } did not throw exception. |
40 PASS namespace = {}; namespace.A = class A { }; namespace.B = class B extends na
mespace.A { } did not throw exception. | 40 PASS namespace = {}; namespace.A = class A { }; namespace.B = class B extends na
mespace.A { } did not throw exception. |
41 PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = cl
ass extends namespace.A { constructor() { } } did not throw exception. | 41 PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = cl
ass extends namespace.A { constructor() { } } did not throw exception. |
42 PASS namespace = {}; namespace.A = class A { constructor() { } }; namespace.B =
class B extends namespace.A { constructor() { } } did not throw exception. | 42 PASS namespace = {}; namespace.A = class A { constructor() { } }; namespace.B =
class B extends namespace.A { constructor() { } } did not throw exception. |
43 PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = cl
ass extends (namespace.A) { constructor() { } } did not throw exception. | 43 PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = cl
ass extends (namespace.A) { constructor() { } } did not throw exception. |
44 PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = cl
ass extends namespace["A"] { constructor() { } } did not throw exception. | 44 PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = cl
ass extends namespace["A"] { constructor() { } } did not throw exception. |
45 PASS namespace = {}; namespace.A = class { constructor() { } }; function getClas
sA() { return namespace.A }; namespace.B = class extends getClassA() { construct
or() { } } did not throw exception. | 45 PASS namespace = {}; namespace.A = class { constructor() { } }; function getClas
sA() { return namespace.A }; namespace.B = class extends getClassA() { construct
or() { } } did not throw exception. |
46 PASS namespace = {}; namespace.A = class { constructor() { } }; function getClas
s(prop) { return namespace[prop] }; namespace.B = class extends getClass("A") {
constructor() { } } did not throw exception. | 46 PASS namespace = {}; namespace.A = class { constructor() { } }; function getClas
s(prop) { return namespace[prop] }; namespace.B = class extends getClass("A") {
constructor() { } } did not throw exception. |
47 PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = cl
ass extends (false||null||namespace.A) { constructor() { } } did not throw excep
tion. | 47 PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = cl
ass extends (false||null||namespace.A) { constructor() { } } did not throw excep
tion. |
48 PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = cl
ass extends false||null||namespace.A { constructor() { } } threw exception Synta
xError: Unexpected token ||. | 48 PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = cl
ass extends false||null||namespace.A { constructor() { } } threw exception Synta
xError: Unexpected token ||. |
49 PASS x = 1; namespace = {}; namespace.A = class { constructor() { } }; namespace
.B = class extends (x++, namespace.A) { constructor() { } }; did not throw excep
tion. | 49 PASS x = 1; namespace = {}; namespace.A = class { constructor() { } }; namespace
.B = class extends (x++, namespace.A) { constructor() { } }; did not throw excep
tion. |
50 PASS x = 1; namespace = {}; namespace.A = class { constructor() { } }; namespace
.B = class extends (namespace.A, x++) { constructor() { } }; threw exception Typ
eError: Class extends value 1 is not a function or null. | 50 PASS x = 1; namespace = {}; namespace.A = class { constructor() { } }; namespace
.B = class extends (namespace.A, x++) { constructor() { } }; threw exception Typ
eError: Class extends value 1 is not a constructor or null. |
51 PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = cl
ass extends new namespace.A { constructor() { } } threw exception TypeError: Cla
ss extends value [object Object] is not a function or null. | 51 PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = cl
ass extends new namespace.A { constructor() { } } threw exception TypeError: Cla
ss extends value [object Object] is not a constructor or null. |
52 PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = cl
ass extends new namespace.A() { constructor() { } } threw exception TypeError: C
lass extends value [object Object] is not a function or null. | 52 PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = cl
ass extends new namespace.A() { constructor() { } } threw exception TypeError: C
lass extends value [object Object] is not a constructor or null. |
53 PASS x = 1; namespace = {}; namespace.A = class { constructor() { } }; try { nam
espace.B = class extends (x++, namespace.A) { constructor() { } } } catch (e) {
} x is 2 | 53 PASS x = 1; namespace = {}; namespace.A = class { constructor() { } }; try { nam
espace.B = class extends (x++, namespace.A) { constructor() { } } } catch (e) {
} x is 2 |
54 PASS x = 1; namespace = {}; namespace.A = class { constructor() { } }; try { nam
espace.B = class extends (namespace.A, x++) { constructor() { } } } catch (e) {
} x is 2 | 54 PASS x = 1; namespace = {}; namespace.A = class { constructor() { } }; try { nam
espace.B = class extends (namespace.A, x++) { constructor() { } } } catch (e) {
} x is 2 |
55 PASS Object.getPrototypeOf((class { constructor () { } }).prototype) is Object.p
rototype | 55 PASS Object.getPrototypeOf((class { constructor () { } }).prototype) is Object.p
rototype |
56 PASS Object.getPrototypeOf((class extends null { constructor () { super(); } }).
prototype) is null | 56 PASS Object.getPrototypeOf((class extends null { constructor () { super(); } }).
prototype) is null |
57 PASS new (class extends undefined { constructor () { this } }) threw exception T
ypeError: Class extends value undefined is not a function or null. | 57 PASS new (class extends undefined { constructor () { this } }) threw exception T
ypeError: Class extends value undefined is not a constructor or null. |
58 PASS new (class extends undefined { constructor () { super(); } }) threw excepti
on TypeError: Class extends value undefined is not a function or null. | 58 PASS new (class extends undefined { constructor () { super(); } }) threw excepti
on TypeError: Class extends value undefined is not a constructor or null. |
59 PASS x = {}; new (class extends undefined { constructor () { return x; } }) thre
w exception TypeError: Class extends value undefined is not a function or null. | 59 PASS x = {}; new (class extends undefined { constructor () { return x; } }) thre
w exception TypeError: Class extends value undefined is not a constructor or nul
l. |
60 PASS y = 12; new (class extends undefined { constructor () { return y; } }) thre
w exception TypeError: Class extends value undefined is not a function or null. | 60 PASS y = 12; new (class extends undefined { constructor () { return y; } }) thre
w exception TypeError: Class extends value undefined is not a constructor or nul
l. |
61 PASS class x {}; new (class extends null { constructor () { return new x; } }) i
nstanceof x is true | 61 PASS class x {}; new (class extends null { constructor () { return new x; } }) i
nstanceof x is true |
62 PASS new (class extends null { constructor () { this; } }) threw exception Refer
enceError: this is not defined. | 62 PASS new (class extends null { constructor () { this; } }) threw exception Refer
enceError: this is not defined. |
63 PASS new (class extends null { constructor () { super(); } }) threw exception Ty
peError: super is not a constructor. | 63 PASS new (class extends null { constructor () { super(); } }) threw exception Ty
peError: super is not a constructor. |
64 PASS x = {}; new (class extends null { constructor () { return x } }) is x | 64 PASS x = {}; new (class extends null { constructor () { return x } }) is x |
65 PASS y = 12; new (class extends null { constructor () { return y; } }) threw exc
eption TypeError: Derived constructors may only return object or undefined. | 65 PASS y = 12; new (class extends null { constructor () { return y; } }) threw exc
eption TypeError: Derived constructors may only return object or undefined. |
66 PASS class x {}; new (class extends null { constructor () { return new x; } }) i
nstanceof x is true | 66 PASS class x {}; new (class extends null { constructor () { return new x; } }) i
nstanceof x is true |
67 PASS x = null; Object.getPrototypeOf((class extends x { }).prototype) is null | 67 PASS x = null; Object.getPrototypeOf((class extends x { }).prototype) is null |
68 PASS Object.prototype.isPrototypeOf(class { }) is true | 68 PASS Object.prototype.isPrototypeOf(class { }) is true |
69 PASS Function.prototype.isPrototypeOf(class { }) is true | 69 PASS Function.prototype.isPrototypeOf(class { }) is true |
70 PASS successfullyParsed is true | 70 PASS successfullyParsed is true |
71 | 71 |
72 TEST COMPLETE | 72 TEST COMPLETE |
OLD | NEW |