49 lines
3.0 KiB
Plaintext
49 lines
3.0 KiB
Plaintext
Tests for string and numeric method names for ES6 class syntax
|
|
|
|
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
|
|
|
|
|
|
PASS constructorCallCount = 0; new (class { "constructor"() { constructorCallCount++; } }); constructorCallCount is 1
|
|
PASS class A { 'constructor'() { constructorCallCount++; } }; new A; constructorCallCount is 2
|
|
PASS new (class { constructor() {} "constructor"() {} }); threw exception SyntaxError: Cannot declare multiple constructors in a single class..
|
|
PASS new (class { constructor() {} static "prototype"() {} }); threw exception SyntaxError: Cannot declare a static method named 'prototype'..
|
|
PASS class A { 'foo'() { return 3; } }; (new A).foo() is 3
|
|
PASS class A { get 'foo'() { return 4; } }; (new A).foo is 4
|
|
PASS class A { get 'foo'() { return 4; } }; A.foo is undefined
|
|
PASS class A { static get 'foo'() { return 5; } }; A.foo is 5
|
|
PASS class A { static get 'foo'() { return 5; } }; (new A).foo is undefined
|
|
PASS fooValue = 0; X = class { set 'foo'(value) { fooValue = value; } }; (new X).foo = 6; fooValue is 6
|
|
PASS X.foo = 7; fooValue is 6
|
|
PASS fooValue = 0; X = class { static set 'foo'(value) { fooValue = value; } }; X.foo = 8; fooValue is 8
|
|
PASS (new X).foo = 7; fooValue is 8
|
|
PASS X = class { get 'foo'() { return 9 } set 'foo'(x) { } }; x = new X; x.foo is 9
|
|
PASS X.foo is undefined
|
|
PASS fooValue = 0; X = class { get 'foo'() { } set 'foo'(x) { fooValue = x } }; (new X).foo = 9; fooValue is 9
|
|
PASS X.foo = 10; fooValue is 9
|
|
PASS X = class { static set 'foo'(x) { } static get 'foo'() { return 10 } }; X.foo is 10
|
|
PASS (new X).foo is undefined
|
|
PASS fooValue = 0; X = class { static set 'foo'(x) { fooValue = x } static get 'foo'() { } }; X.foo = 11; fooValue is 11
|
|
PASS (new X).foo = 12; fooValue is 11
|
|
PASS class A { get 0() { return 20; } }; (new A)[0] is 20
|
|
PASS class A { get 0() { return 20; } }; A[0] is undefined
|
|
PASS class A { static get 1() { return 21; } }; A[1] is 21
|
|
PASS class A { static get 1() { return 21; } }; (new A)[1] is undefined
|
|
PASS setterValue = 0; X = class { set 2(x) { setterValue = x; } }; (new X)[2] = 22; setterValue is 22
|
|
PASS X[2] = 23; setterValue is 22
|
|
PASS setterValue = 0; X = class { static set 3(x) { setterValue = x; } }; X[3] = 23; setterValue is 23
|
|
PASS (new X)[3] = 23; setterValue is 23
|
|
PASS X = class { get 4() { return 24 } set 4(x) { } }; x = new X; x[4] is 24
|
|
PASS X[4] is undefined
|
|
PASS setterValue = 0; X = class { get 5() { } set 5(x) { setterValue = x; } }; (new X)[5] = 25; setterValue is 25
|
|
PASS X[5] = 26; setterValue is 25
|
|
PASS X = class { static set 6(x) { } static get 6() { return 26 } }; X[6] is 26
|
|
PASS (new X)[6] is undefined
|
|
PASS setterValue = 0; X = class { static set 7(x) { setterValue = x } static get 7() { } }; X[7] = 27; setterValue is 27
|
|
PASS (new X)[7] = 28; setterValue is 27
|
|
PASS function x() { return class { 'foo bar'() { return 29; } } }; (new (x()))['foo bar']() is 29
|
|
PASS function x() { return class { 30() { return 30; } } }; (new (x()))[30]() is 30
|
|
PASS successfullyParsed is true
|
|
|
|
TEST COMPLETE
|
|
|