1Tests for ES6 class constructor return values 2 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 5 6Base class 7PASS (new BaseNoReturn) instanceof BaseNoReturn is true 8PASS (new BaseReturnImplicit) instanceof BaseReturnImplicit is true 9PASS (new BaseReturnImplicit) !== undefined is true 10PASS (new BaseReturnUndefined) instanceof BaseReturnUndefined is true 11PASS (new BaseReturnUndefined) !== undefined is true 12PASS (new BaseReturnThis) instanceof BaseReturnThis is true 13PASS (new BaseReturnObject) instanceof BaseReturnObject is false 14PASS typeof (new BaseReturnObject) === "object" is true 15PASS (new BaseReturnObject2) instanceof BaseReturnObject is false 16PASS (new BaseReturnObject2) === globalVariable is true 17PASS (new BaseReturnString) instanceof BaseReturnString is true 18PASS typeof (new BaseReturnString) !== "string" is true 19PASS (new BaseReturnNumber) instanceof BaseReturnNumber is true 20PASS typeof (new BaseReturnNumber) !== "number" is true 21PASS (new BaseReturnNull) instanceof BaseReturnNull is true 22PASS (new BaseReturnNull) !== null is true 23PASS (new BaseReturnSymbol) instanceof BaseReturnSymbol is true 24PASS (new BaseReturnSymbol) !== globalSymbol is true 25PASS (new BaseThrow) threw exception Thrown Exception String. 26 27Function constructor (non-class) 28PASS (new FunctionNoReturn) instanceof FunctionNoReturn is true 29PASS (new FunctionReturnImplicit) instanceof FunctionReturnImplicit is true 30PASS (new FunctionReturnImplicit) !== undefined is true 31PASS (new FunctionReturnUndefined) instanceof FunctionReturnUndefined is true 32PASS (new FunctionReturnUndefined) !== undefined is true 33PASS (new FunctionReturnThis) instanceof FunctionReturnThis is true 34PASS (new FunctionReturnObject) instanceof FunctionReturnObject is false 35PASS typeof (new FunctionReturnObject) === "object" is true 36PASS (new FunctionReturnObject2) instanceof FunctionReturnObject is false 37PASS (new FunctionReturnObject2) === globalVariable is true 38PASS (new FunctionReturnString) instanceof FunctionReturnString is true 39PASS typeof (new FunctionReturnString) !== "string" is true 40PASS (new FunctionReturnNumber) instanceof FunctionReturnNumber is true 41PASS typeof (new FunctionReturnNumber) !== "number" is true 42PASS (new FunctionReturnNull) instanceof FunctionReturnNull is true 43PASS (new FunctionReturnNull) !== null is true 44PASS (new FunctionReturnSymbol) instanceof FunctionReturnSymbol is true 45PASS (new FunctionReturnSymbol) !== globalSymbol is true 46PASS (new FunctionThrow) threw exception Thrown Exception String. 47 48Derived class calling super() 49PASS (new DerivedNoReturn) instanceof DerivedNoReturn is true 50PASS (new DerivedReturnImplicit) instanceof DerivedReturnImplicit is true 51PASS (new DerivedReturnImplicit) !== undefined is true 52PASS (new DerivedReturnUndefined) instanceof DerivedReturnUndefined is true 53PASS (new DerivedReturnUndefined) !== undefined is true 54PASS (new DerivedReturnThis) instanceof DerivedReturnThis is true 55PASS (new DerivedReturnObject) instanceof DerivedReturnObject is false 56PASS typeof (new DerivedReturnObject) === "object" is true 57PASS (new DerivedReturnObject2) instanceof DerivedReturnObject2 is false 58PASS (new DerivedReturnObject2) === globalVariable is true 59PASS (new DerivedReturnString) threw exception TypeError: Derived constructors may only return object or undefined. 60PASS (new DerivedReturnNumber) threw exception TypeError: Derived constructors may only return object or undefined. 61PASS (new DerivedReturnNull) threw exception TypeError: Derived constructors may only return object or undefined. 62PASS (new DerivedReturnSymbol) threw exception TypeError: Derived constructors may only return object or undefined. 63PASS (new DerivedThrow) threw exception Thrown Exception String. 64 65Derived class not calling super() 66PASS (new DerivedNoSuperNoReturn) threw exception ReferenceError: this is not defined. 67PASS (new DerivedNoSuperReturnImplicit) threw exception ReferenceError: DerivedNoSuperReturnImplicit is not defined. 68PASS (new DerivedNoSuperReturnUndefined) threw exception ReferenceError: this is not defined. 69PASS (new DerivedNoSuperReturnThis) threw exception ReferenceError: this is not defined. 70PASS (new DerivedNoSuperReturnObject) did not throw exception. 71PASS (new DerivedNoSuperReturnObject2) did not throw exception. 72PASS (new DerivedNoSuperReturnString) threw exception TypeError: Derived constructors may only return object or undefined. 73PASS (new DerivedNoSuperReturnNumber) threw exception TypeError: Derived constructors may only return object or undefined. 74PASS (new DerivedNoSuperReturnNull) threw exception TypeError: Derived constructors may only return object or undefined. 75PASS (new DerivedNoSuperReturnSymbol) threw exception TypeError: Derived constructors may only return object or undefined. 76PASS (new DerivedNoSuperThrow) threw exception Thrown Exception String. 77 78Derived class with default constructor and base class returning different values 79PASS (new DerivedDefaultConstructorWithBaseNoReturn) instanceof DerivedDefaultConstructorWithBaseNoReturn is true 80PASS (new DerivedDefaultConstructorWithBaseReturnImplicit) instanceof DerivedDefaultConstructorWithBaseReturnImplicit is true 81PASS (new DerivedDefaultConstructorWithBaseReturnUndefined) instanceof DerivedDefaultConstructorWithBaseReturnUndefined is true 82PASS (new DerivedDefaultConstructorWithBaseReturnObject) instanceof DerivedDefaultConstructorWithBaseReturnObject is false 83PASS typeof (new DerivedDefaultConstructorWithBaseReturnObject) === "object" is true 84PASS (new DerivedDefaultConstructorWithBaseReturnObject2) instanceof DerivedDefaultConstructorWithBaseReturnObject2 is false 85PASS (new DerivedDefaultConstructorWithBaseReturnObject2) === globalVariable is true 86PASS (new DerivedDefaultConstructorWithBaseReturnThis) instanceof DerivedDefaultConstructorWithBaseReturnThis is true 87PASS (new DerivedDefaultConstructorWithBaseReturnString) instanceof DerivedDefaultConstructorWithBaseReturnString is true 88PASS (new DerivedDefaultConstructorWithBaseReturnNumber) instanceof DerivedDefaultConstructorWithBaseReturnNumber is true 89PASS (new DerivedDefaultConstructorWithBaseReturnNull) instanceof DerivedDefaultConstructorWithBaseReturnNull is true 90PASS (new DerivedDefaultConstructorWithBaseReturnSymbol) instanceof DerivedDefaultConstructorWithBaseReturnSymbol is true 91PASS (new DerivedDefaultConstructorWithBaseThrow) threw exception Thrown Exception String. 92PASS successfullyParsed is true 93 94TEST COMPLETE 95