node/deps/v8/test/webkit/class-syntax-extends-expected.txt
Ben Noordhuis 70d1f32f56 deps: update v8 to 4.4.63.9
Upgrade the bundled V8 and update code in src/ and lib/ to the new API.

Notable backwards incompatible changes are the removal of the smalloc
module and dropped support for CESU-8 decoding.  CESU-8 support can be
brought back if necessary by doing UTF-8 decoding ourselves.

This commit includes https://codereview.chromium.org/1192973004 to fix
a build error on python 2.6 systems.  The original commit log follows:

    Use optparse in js2c.py for python compatibility

    Without this change, V8 won't build on RHEL/CentOS 6 because the
    distro python is too old to know about the argparse module.

PR-URL: https://github.com/nodejs/io.js/pull/2022
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-08-04 11:56:14 -07:00

72 lines
7.2 KiB
Text

Tests for ES6 class syntax "extends"
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS (new Base) instanceof Base is true
PASS Object.getPrototypeOf(new Base) is Base.prototype
PASS (new Derived) instanceof Derived is true
PASS Object.getPrototypeOf(new Derived) is Derived.prototype
PASS Object.getPrototypeOf(Derived.prototype) is Base.prototype
PASS (new Derived).baseMethod() is "base"
PASS (new Derived).overridenMethod() is "derived"
PASS Derived.staticBaseMethod() is "base"
PASS Derived.staticOverridenMethod() is "derived"
PASS x = class extends threw exception SyntaxError: Unexpected end of input.
PASS x = class extends threw exception SyntaxError: Unexpected end of input.
PASS x = class extends Base { threw exception SyntaxError: Unexpected end of input.
PASS x = class extends Base { } did not throw exception.
PASS x = class extends Base { constructor() { } } did not throw exception.
PASS x.__proto__ is Base
PASS Object.getPrototypeOf(x) is Base
PASS x.prototype.__proto__ is Base.prototype
PASS Object.getPrototypeOf(x.prototype) is Base.prototype
PASS x = class extends null { constructor() { } }; x.__proto__ is Function.prototype
PASS x.__proto__ is Function.prototype
PASS x = class extends 3 { constructor() { } }; x.__proto__ threw exception TypeError: Class extends value 3 is not a function or null.
PASS x = class extends "abc" { constructor() { } }; x.__proto__ threw exception TypeError: Class extends value abc is not a function or null.
PASS baseWithBadPrototype = function () {}; baseWithBadPrototype.prototype = 3; new baseWithBadPrototype did not throw exception.
PASS x = class extends baseWithBadPrototype { constructor() { } } threw exception TypeError: Class extends value does not have valid prototype property 3.
PASS baseWithBadPrototype.prototype = "abc" did not throw exception.
PASS x = class extends baseWithBadPrototype { constructor() { } } threw exception TypeError: Class extends value does not have valid prototype property abc.
PASS baseWithBadPrototype.prototype = null; x = class extends baseWithBadPrototype { constructor() { } } did not throw exception.
PASS x = 1; c = class extends ++x { constructor() { } }; threw exception SyntaxError: Unexpected token ++.
PASS x = 1; c = class extends x++ { constructor() { } }; threw exception SyntaxError: Unexpected token ++.
PASS x = 1; c = class extends (++x) { constructor() { } }; threw exception TypeError: Class extends value 2 is not a function or null.
PASS x = 1; c = class extends (x++) { constructor() { } }; threw exception TypeError: Class extends value 1 is not a function or null.
PASS x = 1; try { c = class extends (++x) { constructor() { } } } catch (e) { }; x is 2
PASS x = 1; try { c = class extends (x++) { constructor() { } } } catch (e) { }; x is 2
PASS namespace = {}; namespace.A = class { }; namespace.B = class extends namespace.A { } did not throw exception.
PASS namespace = {}; namespace.A = class A { }; namespace.B = class B extends namespace.A { } did not throw exception.
PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends namespace.A { constructor() { } } did not throw exception.
PASS namespace = {}; namespace.A = class A { constructor() { } }; namespace.B = class B extends namespace.A { constructor() { } } did not throw exception.
PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends (namespace.A) { constructor() { } } did not throw exception.
PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends namespace["A"] { constructor() { } } did not throw exception.
PASS namespace = {}; namespace.A = class { constructor() { } }; function getClassA() { return namespace.A }; namespace.B = class extends getClassA() { constructor() { } } did not throw exception.
PASS namespace = {}; namespace.A = class { constructor() { } }; function getClass(prop) { return namespace[prop] }; namespace.B = class extends getClass("A") { constructor() { } } did not throw exception.
PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends (false||null||namespace.A) { constructor() { } } did not throw exception.
PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends false||null||namespace.A { constructor() { } } threw exception SyntaxError: Unexpected token ||.
PASS x = 1; namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends (x++, namespace.A) { constructor() { } }; did not throw exception.
PASS x = 1; namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends (namespace.A, x++) { constructor() { } }; threw exception TypeError: Class extends value 1 is not a function or null.
PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends new namespace.A { constructor() { } } threw exception TypeError: Class extends value [object Object] is not a function or null.
PASS namespace = {}; namespace.A = class { constructor() { } }; namespace.B = class extends new namespace.A() { constructor() { } } threw exception TypeError: Class extends value [object Object] is not a function or null.
PASS x = 1; namespace = {}; namespace.A = class { constructor() { } }; try { namespace.B = class extends (x++, namespace.A) { constructor() { } } } catch (e) { } x is 2
PASS x = 1; namespace = {}; namespace.A = class { constructor() { } }; try { namespace.B = class extends (namespace.A, x++) { constructor() { } } } catch (e) { } x is 2
PASS Object.getPrototypeOf((class { constructor () { } }).prototype) is Object.prototype
PASS Object.getPrototypeOf((class extends null { constructor () { super(); } }).prototype) is null
PASS new (class extends undefined { constructor () { this } }) threw exception TypeError: Class extends value undefined is not a function or null.
PASS new (class extends undefined { constructor () { super(); } }) threw exception TypeError: Class extends value undefined is not a function or null.
PASS x = {}; new (class extends undefined { constructor () { return x; } }) threw exception TypeError: Class extends value undefined is not a function or null.
PASS y = 12; new (class extends undefined { constructor () { return y; } }) threw exception TypeError: Class extends value undefined is not a function or null.
FAIL class x {}; new (class extends null { constructor () { return new x; } }) instanceof x should be true. Threw exception TypeError: x is not a function
PASS new (class extends null { constructor () { this; } }) threw exception ReferenceError: this is not defined.
PASS new (class extends null { constructor () { super(); } }) threw exception TypeError: function () {} is not a constructor.
PASS x = {}; new (class extends null { constructor () { return x } }) is x
PASS y = 12; new (class extends null { constructor () { return y; } }) threw exception TypeError: Derived constructors may only return object or undefined.
FAIL class x {}; new (class extends null { constructor () { return new x; } }) instanceof x should be true. Threw exception TypeError: x is not a function
PASS x = null; Object.getPrototypeOf((class extends x { }).prototype) is null
PASS Object.prototype.isPrototypeOf(class { }) is true
PASS Function.prototype.isPrototypeOf(class { }) is true
PASS successfullyParsed is true
TEST COMPLETE