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