diff options
Diffstat (limited to 'external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator')
20 files changed, 594 insertions, 0 deletions
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A1.js new file mode 100644 index 000000000..bae86c92f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A1.js @@ -0,0 +1,59 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.8.6_A1; +* @section: 11.8.6, 7.2, 7.3; +* @assertion: White Space and Line Terminator between RelationalExpression and "instanceof" and between "instanceof" and ShiftExpression are allowed; +* @description: Checking by using eval; +*/ + +//CHECK#1 +if (eval("({})\u0009instanceof\u0009Object") !== true) { + $ERROR('#1: ({})\\u0009instanceof\\u0009Object === true'); +} + +//CHECK#2 +if (eval("({})\u000Binstanceof\u000BObject") !== true) { + $ERROR('#2: ({})\\u000Binstanceof\\u000BObject === true'); +} + +//CHECK#3 +if (eval("({})\u000Cinstanceof\u000CObject") !== true) { + $ERROR('#3: ({})\\u000Cinstanceof\\u000CObject === true'); +} + +//CHECK#4 +if (eval("({})\u0020instanceof\u0020Object") !== true) { + $ERROR('#4: ({})\\u0020instanceof\\u0020Object === true'); +} + +//CHECK#5 +if (eval("({})\u00A0instanceof\u00A0Object") !== true) { + $ERROR('#5: ({})\\u00A0instanceof\\u00A0Object === true'); +} + +//CHECK#6 +if (eval("({})\u000Ainstanceof\u000AObject") !== true) { + $ERROR('#6: ({})\\u000Ainstanceof\\u000AObject === true'); +} + +//CHECK#7 +if (eval("({})\u000Dinstanceof\u000DObject") !== true) { + $ERROR('#7: ({})\\u000Dinstanceof\\u000DObject === true'); +} + +//CHECK#8 +if (eval("({})\u2028instanceof\u2028Object") !== true) { + $ERROR('#8: ({})\\u2028instanceof\\u2028Object === true'); +} + +//CHECK#9 +if (eval("({})\u2029instanceof\u2029Object") !== true) { + $ERROR('#9: ({})\\u2029instanceof\\u2029Object === true'); +} + +//CHECK#10 +if (eval("({})\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029instanceof\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029Object") !== true) { + $ERROR('#10: ({})\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029instanceof\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029Object === true'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.1_T1.js new file mode 100644 index 000000000..7cf637264 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.1_T1.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S11.8.6_A2.1_T1; + * @section: 11.8.6; + * @assertion: Operator "instanceof" uses GetValue; + * @description: Either Expression is not Reference or GetBase is not null; +*/ + +//CHECK#1 +if (({}) instanceof Object !== true) { + $ERROR('#1: ({}) instanceof Object === true'); +} + +//CHECK#2 +var object = {}; +if (object instanceof Object !== true) { + $ERROR('#2: var object = {}; object instanceof Object === true'); +} + +//CHECK#3 +var OBJECT = Object; +if (({}) instanceof OBJECT !== true) { + $ERROR('#3: var OBJECT = Object; ({}) instanceof OBJECT === true'); +} + +//CHECK#4 +var object = {}; +var OBJECT = Object; +if (object instanceof OBJECT !== true) { + $ERROR('#4: var object = {}; var OBJECT = Object; object instanceof OBJECT === true'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.1_T2.js new file mode 100644 index 000000000..74da3f4e4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.1_T2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.8.6_A2.1_T2; +* @section: 11.8.6; +* @assertion: Operator "instanceof" uses GetValue; +* @description: If GetBase(RelationalExpression) is null, throw ReferenceError; +*/ + +//CHECK#1 +try { + object instanceof Object; + $ERROR('#1.1: object instanceof Object throw ReferenceError. Actual: ' + (object instanceof Object)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: object instanceof Object throw ReferenceError. Actual: ' + (e)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.1_T3.js new file mode 100644 index 000000000..87352bc41 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.1_T3.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.8.6_A2.1_T3; +* @section: 11.8.6; +* @assertion: Operator "instanceof" uses GetValue; +* @description: If GetBase(ShiftExpression) is null, throw ReferenceError; +*/ + +//CHECK#1 +try { + ({}) instanceof OBJECT; + $ERROR('#1.1: ({}) instanceof OBJECT throw ReferenceError. Actual: ' + (({}) instanceof OBJECT)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: ({}) instanceof OBJECT throw ReferenceError. Actual: ' + (e)); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.4_T1.js new file mode 100644 index 000000000..d285ad028 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.4_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S11.8.6_A2.4_T1; + * @section: 11.8.6; + * @assertion: First expression is evaluated first, and then second expression; + * @description: Checking with "="; +*/ + +//CHECK#1 +var OBJECT = 0; +if ((OBJECT = Object, {}) instanceof OBJECT !== true) { + $ERROR('#1: var OBJECT = 0; (OBJECT = Object, {}) instanceof OBJECT === true'); +} + +//CHECK#2 +var object = {}; +if (object instanceof (object = 0, Object) !== true) { + $ERROR('#2: var object = {}; object instanceof (object = 0, Object) === true'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.4_T2.js new file mode 100644 index 000000000..33292f527 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.4_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S11.8.6_A2.4_T2; + * @section: 11.8.6; + * @assertion: First expression is evaluated first, and then second expression; + * @description: Checking with "throw"; +*/ + +//CHECK#1 +var x = function () { throw "x"; }; +var y = function () { throw "y"; }; +try { + x() instanceof y(); + $ERROR('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() instanceof y() throw "x". Actual: ' + (x() instanceof y())); +} catch (e) { + if (e === "y") { + $ERROR('#1.2: First expression is evaluated first, and then second expression'); + } else { + if (e !== "x") { + $ERROR('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() instanceof y() throw "x". Actual: ' + (e)); + } + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.4_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.4_T3.js new file mode 100644 index 000000000..a30e58164 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A2.4_T3.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S11.8.6_A2.4_T3; + * @section: 11.8.6; + * @assertion: First expression is evaluated first, and then second expression; + * @description: Checking with undeclarated variables; +*/ + +//CHECK#1 +try { + object instanceof (object = {}, Object); + $ERROR('#1.1: object instanceof (object = {}, Object) throw ReferenceError. Actual: ' + (object instanceof (object = {}, Object))); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: object instanceof (object = {}, Object) throw ReferenceError. Actual: ' + (e)); + } +} + +//CHECK#2 +if ((OBJECT = Object, {}) instanceof OBJECT !== true) { + $ERROR('#2: (OBJECT = Object, {}) instanceof OBJECT !== true'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A3.js new file mode 100644 index 000000000..e7d2a2107 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A3.js @@ -0,0 +1,64 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.8.6_A3; +* @section: 11.8.6; +* @assertion: If ShiftExpression is not an object, throw TypeError; +* @description: Checking all the types of primitives; +*/ + +//CHECK#1 +try { + true instanceof true; + $ERROR('#1: true instanceof true throw TypeError'); +} +catch (e) { + if (e instanceof TypeError !== true) { + $ERROR('#1: true instanceof true throw TypeError'); + } +} + +//CHECK#2 +try { + 1 instanceof 1; + $ERROR('#2: 1 instanceof 1 throw TypeError'); +} +catch (e) { + if (e instanceof TypeError !== true) { + $ERROR('#2: 1 instanceof 1 throw TypeError'); + } +} + +//CHECK#3 +try { + "string" instanceof "string"; + $ERROR('#3: "string" instanceof "string" throw TypeError'); +} +catch (e) { + if (e instanceof TypeError !== true) { + $ERROR('#3: "string" instanceof "string" throw TypeError'); + } +} + +//CHECK#4 +try { + undefined instanceof undefined; + $ERROR('#4: undefined instanceof undefined throw TypeError'); +} +catch (e) { + if (e instanceof TypeError !== true) { + $ERROR('#4: undefined instanceof undefined throw TypeError'); + } +} + +//CHECK#5 +try { + null instanceof null; + $ERROR('#5: null instanceof null throw TypeError'); +} +catch (e) { + if (e instanceof TypeError !== true) { + $ERROR('#5: null instanceof null throw TypeError'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A4_T1.js new file mode 100644 index 000000000..16d69f904 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A4_T1.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.8.6_A4_T1; +* @section: 11.8.6; +* @assertion: Only constructor call (with "new" keyword) makes instance; +* @description: Checking Boolean case; +*/ + +//CHECK#1 +if (false instanceof Boolean) { + $ERROR('#1: false is not instanceof Boolean'); +} + +//CHECK#2 +if (Boolean(false) instanceof Boolean) { + $ERROR('#2: Boolean(false) is not instanceof Boolean'); +} + +//CHECK#3 +if (new Boolean instanceof Boolean !== true) { + $ERROR('#3: new Boolean instanceof Boolean'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A4_T2.js new file mode 100644 index 000000000..cc4f50454 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A4_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.8.6_A4_T2; +* @section: 11.8.6; +* @assertion: Only constructor call (with "new" keyword) makes instance; +* @description: Checking Number case; +*/ + +//CHECK#1 +if (0 instanceof Number) { + $ERROR('#1: 0 is not instanceof Number'); +} + +//CHECK#2 +if (Number(0) instanceof Number) { + $ERROR('#2: Number(0) is not instanceof Number'); +} + +//CHECK#3 +if (new Number instanceof Number !== true) { + $ERROR('#3: new Number instanceof Number'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A4_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A4_T3.js new file mode 100644 index 000000000..035120958 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A4_T3.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.8.6_A4_T3; +* @section: 11.8.6; +* @assertion: Only constructor call (with "new" keyword) makes instance; +* @description: Checking String case; +*/ + +//CHECK#1 +if ("" instanceof String) { + $ERROR('#1: "" is not instanceof String'); +} + +//CHECK#2 +if (String("") instanceof String) { + $ERROR('#2: String("") is not instanceof String'); +} + +//CHECK#3 +if (new String instanceof String !== true) { + $ERROR('#3: new String instanceof String'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A5_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A5_T1.js new file mode 100644 index 000000000..4e139a9c7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A5_T1.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.8.6_A5_T1; +* @section: 11.8.6; +* @assertion: TypeError is subclass of Error from instanceof operator point of view; +* @description: Checking Error case; +*/ + +var __err = new Error; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!(__err instanceof Error)) { + $ERROR('#1: TypeError is subclass of Error from instanceof operator poit of view'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__err instanceof TypeError) { + $ERROR('#2: TypeError is subclass of Error from instanceof operator poit of view'); +} +// +////////////////////////////////////////////////////////////////////////////// + +var err__ = Error('failed'); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (!(err__ instanceof Error)) { + $ERROR('#3: TypeError is subclass of Error from instanceof operator poit of view'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (err__ instanceof TypeError) { + $ERROR('#4: TypeError is subclass of Error from instanceof operator poit of view'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A5_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A5_T2.js new file mode 100644 index 000000000..3896a1c01 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A5_T2.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.8.6_A5_T2; +* @section: 11.8.6; +* @assertion: TypeError is subclass of Error from instanceof operator point of view; +* @description: Checking TypeError case; +*/ + +var __t__err = new TypeError; + +//CHECK#1 +if (!(__t__err instanceof Error)) { + $ERROR('#1: TypeError is subclass of Error from instanceof operator poit of view'); +} + +//CHECK#2 +if (!(__t__err instanceof TypeError)) { + $ERROR('#2: TypeError is subclass of Error from instanceof operator poit of view'); +} + +////////////////////////////////////////////////////////////////////////////// +var err__t__ = TypeError('failed'); + +//CHECK#3 +if (!(err__t__ instanceof Error)) { + $ERROR('#3: TypeError is subclass of Error from instanceof operator poit of view'); +} + +//CHECK#4 +if (!(err__t__ instanceof TypeError)) { + $ERROR('#4: TypeError is subclass of Error from instanceof operator poit of view'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A6_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A6_T1.js new file mode 100644 index 000000000..330bf01ce --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A6_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.8.6_A6_T1; +* @section: 11.8.6; +* @assertion: Only Function objects implement [[HasInstance]] and can be proper ShiftExpression for the "instanceof" operator consequently +* @description: Checking "this" case; +*/ + +//CHECK#1 +try{ + ({}) instanceof this; + $ERROR('#1: Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); +} +catch(e){ + if (e instanceof TypeError !== true) { + $ERROR('#1: Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A6_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A6_T2.js new file mode 100644 index 000000000..9575f673f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A6_T2.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.8.6_A6_T2; +* @section: 11.8.6; +* @assertion: Only Function objects implement [[HasInstance]] and can be proper ShiftExpression for the "instanceof" operator consequently; +* @description: Checking Math case; +*/ + +//CHECK#1 +try{ + 1 instanceof Math; + $ERROR('#1: 1 instanceof Math throw TypeError'); +} +catch(e){ + if (e instanceof TypeError !== true) { + $ERROR('#1: 1 instanceof Math throw TypeError'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A6_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A6_T3.js new file mode 100644 index 000000000..40184d2a6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A6_T3.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.8.6_A6_T3; +* @section: 11.8.6; +* @assertion: Only Function objects implement [[HasInstance]] and can be proper ShiftExpression for the "instanceof" operator consequently; +* @description: Checking if RelationalExpression is function; +*/ + +function MyFunct(){return 0}; + +//CHECK#1 +if (MyFunct instanceof MyFunct){ + $ERROR('#1 function MyFunct(){return 0}; MyFunct instanceof MyFunct === false'); +} + +//CHECK#2 +if (MyFunct instanceof Function !== true){ + $ERROR('#2 function MyFunct(){return 0}; MyFunct instanceof Function === true'); +} + +//CHECK#3 +if (MyFunct instanceof Object !== true){ + $ERROR('#3 function MyFunct(){return 0}; MyFunct instanceof Object === true'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A6_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A6_T4.js new file mode 100644 index 000000000..be183635b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A6_T4.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.8.6_A6_T4; +* @section: 11.8.6; +* @assertion: Only Function objects implement [[HasInstance]] and can be proper ShiftExpression for the "instanceof" operator consequently; +* @description: Checking if RelationalExpression is object; +*/ + +MyFunct = function(){}; +__my__funct = new MyFunct; + + +//CHECK#1 +if (!(__my__funct instanceof MyFunct)){ + $ERROR('#1 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); +} + +//CHECK#2 +if (__my__funct instanceof Function){ + $ERROR('#2 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); +} + +//CHECK#3 +if (!(__my__funct instanceof Object)){ + $ERROR('#3 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); +} + +//CHECK#4 +try{ + __my__funct instanceof __my__funct; + $ERROR('#4 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); +} +catch(e){ + if (e instanceof TypeError !== true) { + $ERROR('#4 Only Function objects implement [[HasInstance]] and consequently can be proper ShiftExpression for The instanceof operator'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A7_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A7_T1.js new file mode 100644 index 000000000..7bd2f0041 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A7_T1.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.8.6_A7_T1; +* @section: 11.8.6; +* @assertion: When "instanceof" returns true it means that GetValue(RelationalExpression) is constructed with ShiftExpression; +* @description: Checking Object object; +*/ + +var __obj={}; + +//CHECK#1 +if (!(__obj instanceof Object)) { + $ERROR('#1: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression'); +} + +//CHECK#2 +if (__obj.constructor !== Object) { + $ERROR('#2: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A7_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A7_T2.js new file mode 100644 index 000000000..143fa5c11 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A7_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.8.6_A7_T2; +* @section: 11.8.6; +* @assertion: When "instanceof" returns true it means that GetValue(RelationalExpression) is constructed with ShiftExpression; +* @description: Checking Array object; +*/ + +var __arr=[]; + +//CHECK#1 +if (!(__arr instanceof Array)) { + $ERROR('#1: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression'); +} + +//CHECK#2 +if (__arr.constructor !== Array) { + $ERROR('#2: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A7_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A7_T3.js new file mode 100644 index 000000000..01b877567 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/11_Expressions/11.8_Relational_Operators/11.8.6_The_instanceof_operator/S11.8.6_A7_T3.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S11.8.6_A7_T3; +* @section: 11.8.6; +* @assertion: When "instanceof" returns true it means that GetValue(RelationalExpression) is constructed with ShiftExpression; +* @description: Checking Function object; +*/ + +var __func = new Function; + +//CHECK#1 +if (!(__func instanceof Function)) { + $ERROR('#1: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression'); +} + +//CHECK#2 +if (__func.constructor !== Function) { + $ERROR('#2: If instanceof returns true then GetValue(RelationalExpression) was constructed with ShiftExpression'); +} + |