diff options
Diffstat (limited to 'js/src/tests/test262/language/expressions/logical-not')
21 files changed, 660 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A1.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A1.js new file mode 100644 index 0000000000..fe684a0313 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A1.js @@ -0,0 +1,62 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + White Space and Line Terminator between "!" and UnaryExpression are + allowed +es5id: 11.4.9_A1 +description: Checking by using eval +---*/ + +//CHECK#1 +if (eval("!\u0009true") !== false) { + $ERROR('#true: !\\u0009true === false'); +} + +//CHECK#2 +if (eval("!\u000Btrue") !== false) { + $ERROR('#2: !\\u000Btrue === false'); +} + +//CHECK#3 +if (eval("!\u000Ctrue") !== false) { + $ERROR('#3: !\\u000Ctrue === false'); +} + +//CHECK#4 +if (eval("!\u0020true") !== false) { + $ERROR('#4: !\\u0020 === false'); +} + +//CHECK#5 +if (eval("!\u00A0true") !== false) { + $ERROR('#5: !\\u00A0true === false'); +} + +//CHECK#6 +if (eval("!\u000Atrue") !== false) { + $ERROR('#6: !\\u000Atrue === false'); +} + +//CHECK#7 +if (eval("!\u000Dtrue") !== false) { + $ERROR('#7: !\\u000Dtrue === false'); +} + +//CHECK#8 +if (eval("!\u2028true") !== false) { + $ERROR('#8: !\\u2028true === false'); +} + +//CHECK#9 +if (eval("!\u2029true") !== false) { + $ERROR('#9: !\\u2029true === false'); +} + +//CHECK#10 +if (eval("!\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029true") !== false) { + $ERROR('#10: !\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029true === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.1_T1.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.1_T1.js new file mode 100644 index 0000000000..b2c73d8c1c --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.1_T1.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. + +/*--- +info: Operator !x uses GetValue +es5id: 11.4.9_A2.1_T1 +description: Either Type(x) is not Reference or GetBase(x) is not null +---*/ + +//CHECK#1 +if (!true !== false) { + $ERROR('#1: !true === false'); +} + +//CHECK#2 +if (!(!true) !== true) { + $ERROR('#2: !(!true) === true'); +} + +//CHECK#3 +var x = true; +if (!x !== false) { + $ERROR('#3: var x = true; !x === false'); +} + +//CHECK#4 +var x = true; +if (!(!x) !== true) { + $ERROR('#4: var x = true; !(!x) === true'); +} + +//CHECK#5 +var object = new Object(); +object.prop = true; +if (!object.prop !== false) { + $ERROR('#5: var object = new Object(); object.prop = true; !object.prop === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.1_T2.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.1_T2.js new file mode 100644 index 0000000000..e9ce049029 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.1_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. + +/*--- +info: Operator !x uses GetValue +es5id: 11.4.9_A2.1_T2 +description: If GetBase(x) is null, throw ReferenceError +---*/ + +//CHECK#1 +try { + !x; + $ERROR('#1.1: !x throw ReferenceError. Actual: ' + (!x)); +} +catch (e) { + if ((e instanceof ReferenceError) !== true) { + $ERROR('#1.2: !x throw ReferenceError. Actual: ' + (e)); + } +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.2_T1.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.2_T1.js new file mode 100644 index 0000000000..55ae00dbd0 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A2.2_T1.js @@ -0,0 +1,58 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator !x uses [[Default Value]] +es5id: 11.4.9_A2.2_T1 +description: If Type(value) is Object, return false +---*/ + +//CHECK#1 +var object = {valueOf: function() {return 1}}; +if (!object !== false) { + $ERROR('#1: var object = {valueOf: function() {return 1}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#2 +var object = {valueOf: function() {return 1}, toString: function() {return 0}}; +if (!object !== false) { + $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#3 +var object = {valueOf: function() {return 1}, toString: function() {return {}}}; +if (!object !== false) { + $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#4 +var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; +if (!object !== false) { + $ERROR('#4: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#5 +var object = {toString: function() {return 1}}; +if (!object !== false) { + $ERROR('#5: var object = {toString: function() {return 1}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#6 +var object = {valueOf: function() {return {}}, toString: function() {return 1}} +if (!object !== false) { + $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#7 +var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; +if (!object !== false) { + $ERROR('#7: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; !object === false. Actual: ' + (!object)); +} + +//CHECK#8 +var object = {valueOf: function() {return {}}, toString: function() {return {}}}; +if (!object !== false) { + $ERROR('#8: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; !object === false. Actual: ' + (!object)); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T1.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T1.js new file mode 100644 index 0000000000..d342b8ee2d --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_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. + +/*--- +info: Operator !x returns !ToBoolean(x) +es5id: 11.4.9_A3_T1 +description: Type(x) is boolean primitive or Boolean object +---*/ + +//CHECK#1 +if (!false !== true) { + $ERROR('#1: !false === true'); +} + +//CHECK#2 +if (!new Boolean(true) !== false) { + $ERROR('#2: !new Boolean(true) === false'); +} + +//CHECK#3 +if (!new Boolean(false) !== false) { + $ERROR('#3: !new Boolean(false) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T2.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T2.js new file mode 100644 index 0000000000..c5232f77db --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T2.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Operator !x returns !ToBoolean(x) +es5id: 11.4.9_A3_T2 +description: Type(x) is number primitive or Number object +---*/ + +//CHECK#1 +if (!0.1 !== false) { + $ERROR('#1: !0.1 === false'); +} + +//CHECK#2 +if (!new Number(-0.1) !== false) { + $ERROR('#2: !new Number(-0.1) === false'); +} + +//CHECK#3 +if (!NaN !== true) { + $ERROR('#3: !NaN === true'); +} + +//CHECK#4 +if (!new Number(NaN) !== false) { + $ERROR('#4: !new Number(NaN) === false'); +} + +//CHECK#5 +if (!0 !== true) { + $ERROR('#5: !0 === true'); +} + +//CHECK#6 +if (!new Number(0) !== false) { + $ERROR('#6: !new Number(0) === false'); +} + +//CHECK#7 +if (!Infinity !== false) { + $ERROR('#7: !Infinity === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T3.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T3.js new file mode 100644 index 0000000000..4b07d4ede3 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T3.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. + +/*--- +info: Operator !x returns !ToBoolean(x) +es5id: 11.4.9_A3_T3 +description: Type(x) is string primitive or String object +---*/ + +//CHECK#1 +if (!"1" !== false) { + $ERROR('#1: !"1" === false'); +} + +//CHECK#2 +if (!new String("0") !== false) { + $ERROR('#2: !new String("0") === false'); +} + +//CHECK#3 +if (!"x" !== false) { + $ERROR('#3: !"x" === false'); +} + +//CHECK#4 +if (!"" !== true) { + $ERROR('#4: !"" === true'); +} + +//CHECK#5 +if (!new String("") !== false) { + $ERROR('#5: !new String("") === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T4.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T4.js new file mode 100644 index 0000000000..c3e36d845a --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T4.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. + +/*--- +info: Operator !x returns !ToBoolean(x) +es5id: 11.4.9_A3_T4 +description: Type(x) is undefined or null +---*/ + +//CHECK#1 +if (!void 0 !== true) { + $ERROR('#1: !void 0 === true'); +} + +//CHECK#2 +if (!null !== true) { + $ERROR('#2: !null === true'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T5.js b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T5.js new file mode 100644 index 0000000000..7c3a7e140c --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S11.4.9_A3_T5.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. + +/*--- +info: Operator !x returns !ToBoolean(x) +es5id: 11.4.9_A3_T5 +description: Type(x) is Object object or Function object +---*/ + +//CHECK#1 +if ((!{}) !== false) { + $ERROR('#1: !({}) === false'); +} + +//CHECK#2 +if (!(function(){return 1}) !== false) { + $ERROR('#2: !(function(){return 1}) === false'); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S9.2_A1_T2.js b/js/src/tests/test262/language/expressions/logical-not/S9.2_A1_T2.js new file mode 100644 index 0000000000..2f7b69a39d --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S9.2_A1_T2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Result of boolean conversion from undefined value is false +es5id: 9.2_A1_T2 +description: > + Undefined, void and others are converted to Boolean by implicit + transformation +---*/ + +// CHECK#1 +if (!(undefined) !== true) { + $ERROR('#1: !(undefined) === true. Actual: ' + (!(undefined))); +} + +// CHECK#2 +if (!(void 0) !== true) { + $ERROR('#2: !(undefined) === true. Actual: ' + (!(undefined))); +} + +// CHECK#3 +if (!(eval("var x")) !== true) { + $ERROR('#3: !(eval("var x")) === true. Actual: ' + (!(eval("var x")))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S9.2_A2_T2.js b/js/src/tests/test262/language/expressions/logical-not/S9.2_A2_T2.js new file mode 100644 index 0000000000..46e3f9a70a --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S9.2_A2_T2.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Result of boolean conversion from null value is false +es5id: 9.2_A2_T2 +description: null convert to Boolean by implicit transformation +---*/ + +// CHECK#1 +if (!(null) !== true) { + $ERROR('#1: !(null) === true. Actual: ' + (!(null))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S9.2_A3_T2.js b/js/src/tests/test262/language/expressions/logical-not/S9.2_A3_T2.js new file mode 100644 index 0000000000..eaa4b4fe61 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S9.2_A3_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. + +/*--- +info: Result of boolean conversion from boolean value is no conversion +es5id: 9.2_A3_T2 +description: true and false convert to Boolean by implicit transformation +---*/ + +// CHECK#1 +if (!(true) !== false) { + $ERROR('#1: !(true) === false. Actual: ' + (!(true))); +} + +// CHECK#2 +if (!(false) !== true) { + $ERROR('#2: !(false) === true. Actual: ' + (!(false))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S9.2_A4_T2.js b/js/src/tests/test262/language/expressions/logical-not/S9.2_A4_T2.js new file mode 100644 index 0000000000..79f3519a30 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S9.2_A4_T2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Result of boolean conversion from number value is false if the argument + is +0, -0, or NaN; otherwise, is true +es5id: 9.2_A4_T2 +description: +0, -0 and NaN convert to Boolean by implicit transformation +---*/ + +// CHECK#1 +if (!(+0) !== true) { + $ERROR('#1: !(+0) === true. Actual: ' + (!(+0))); +} + +// CHECK#2 +if (!(-0) !== true) { + $ERROR('#2: !(-0) === true. Actual: ' + (!(-0))); +} + +// CHECK#3 +if (!(Number.NaN) !== true) { + $ERROR('#3: !(Number.NaN) === true. Actual: ' + (!(Number.NaN))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S9.2_A4_T4.js b/js/src/tests/test262/language/expressions/logical-not/S9.2_A4_T4.js new file mode 100644 index 0000000000..a2e60bd784 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S9.2_A4_T4.js @@ -0,0 +1,55 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Result of boolean conversion from number value is false if the argument + is +0, -0, or NaN; otherwise, is true +es5id: 9.2_A4_T4 +description: > + Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, + Number.MAX_VALUE, Number.MIN_VALUE and some other numbers are + converted to Boolean by implicit transformation +---*/ + +// CHECK#1 +if (!(Number.POSITIVE_INFINITY) !== false) { + $ERROR('#1: !(+Infinity) === false. Actual: ' + (!(+Infinity))); +} + +// CHECK#2; +if (!(Number.NEGATIVE_INFINITY) !== false) { + $ERROR('#2: !(-Infinity) === false. Actual: ' + (!(-Infinity))); +} + +// CHECK#3 +if (!(Number.MAX_VALUE) !== false) { + $ERROR('#3: !(Number.MAX_VALUE) === false. Actual: ' + (!(Number.MAX_VALUE))); +} + +// CHECK#4 +if (!(Number.MIN_VALUE) !== false) { + $ERROR('#4: !(Number.MIN_VALUE) === false. Actual: ' + (!(Number.MIN_VALUE))); +} + +// CHECK#5 +if (!(13) !== false) { + $ERROR('#5: !(13) === false. Actual: ' + (!(13))); +} + +// CHECK#6 +if (!(-13) !== false) { + $ERROR('#6: !(-13) === false. Actual: ' + (!(-13))); +} + +// CHECK#7 +if (!(1.3) !== false) { + $ERROR('#7: !(1.3) === false. Actual: ' + (!(1.3))); +} + +// CHECK#8 +if (!(-1.3) !== false) { + $ERROR('#8: !(-1.3) === false. Actual: ' + (!(-1.3))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S9.2_A5_T2.js b/js/src/tests/test262/language/expressions/logical-not/S9.2_A5_T2.js new file mode 100644 index 0000000000..1518122ded --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S9.2_A5_T2.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: | + Result of boolean conversion from nonempty string value (length is not + zero) is true; from empty String (length is zero) is false +es5id: 9.2_A5_T2 +description: "\"\" convert to Boolean by implicit transformation" +---*/ + +// CHECK#1 +if (!("") !== true) { + $ERROR('#1: !("") === true. Actual: ' + (!(""))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S9.2_A5_T4.js b/js/src/tests/test262/language/expressions/logical-not/S9.2_A5_T4.js new file mode 100644 index 0000000000..d1baf671b5 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S9.2_A5_T4.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. + +/*--- +info: | + Result of boolean conversion from nonempty string value (length is not + zero) is true; from empty String (length is zero) is false +es5id: 9.2_A5_T4 +description: Any nonempty string convert to Boolean by implicit transformation +---*/ + +// CHECK#1 +if (!(" ") !== false) { + $ERROR('#1: !(" ") === false. Actual: ' + (!(" "))); +} + +// CHECK#2 +if (!("Nonempty String") !== false) { + $ERROR('#2: !("Nonempty String") === false. Actual: ' + (!("Nonempty String"))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/S9.2_A6_T2.js b/js/src/tests/test262/language/expressions/logical-not/S9.2_A6_T2.js new file mode 100644 index 0000000000..ea9a8fb434 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/S9.2_A6_T2.js @@ -0,0 +1,105 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +info: Result of boolean conversion from object is true +es5id: 9.2_A6_T2 +description: Different objects convert to Boolean by implicit transformation +---*/ + +// CHECK#1 +if (!(new Object()) !== false) { + $ERROR('#1: !(new Object()) === false. Actual: ' + (!(new Object()))); +} + +// CHECK#2 +if (!(new String("")) !== false) { + $ERROR('#2: !(new String("")) === false. Actual: ' + (!(new String("")))); +} + +// CHECK#3 +if (!(new String()) !== false) { + $ERROR('#3: !(new String()) === false. Actual: ' + (!(new String()))); +} + +// CHECK#4 +if (!(new Boolean(true)) !== false) { + $ERROR('#4: !(new Boolean(true)) === false. Actual: ' + (!(new Boolean(true)))); +} + +// CHECK#5 +if (!(new Boolean(false)) !== false) { + $ERROR('#5: !(new Boolean(false)) === false. Actual: ' + (!(new Boolean(false)))); +} + +// CHECK#6 +if (!(new Boolean()) !== false) { + $ERROR('#6: !(new Boolean()) === false. Actual: ' + (!(new Boolean()))); +} + +// CHECK#7 +if (!(new Array()) !== false) { + $ERROR('#7: !(new Array()) === false. Actual: ' + (!(new Array()))); +} + +// CHECK#8 +if (!(new Number()) !== false) { + $ERROR('#8: !(new Number()) === false. Actual: ' + (!(new Number()))); +} + +// CHECK#9 +if (!(new Number(-0)) !== false) { + $ERROR('#9: !(new Number(-0)) === false. Actual: ' + (!(new Number(-0)))); +} + +// CHECK#10 +if (!(new Number(0)) !== false) { + $ERROR('#10: !(new Number(0)) === false. Actual: ' + (!(new Number(0)))); +} + +// CHECK#11 +if (!(new Number()) !== false) { + $ERROR('#11: !(new Number()) === false. Actual: ' + (!(new Number()))); +} + +// CHECK#12 +if (!(new Number(Number.NaN)) !== false) { + $ERROR('#12: !(new Number(Number.NaN)) === false. Actual: ' + (!(new Number(Number.NaN)))); +} + +// CHECK#13 +if (!(new Number(-1)) !== false) { + $ERROR('#13: !(new Number(-1)) === false. Actual: ' + (!(new Number(-1)))); +} + +// CHECK#14 +if (!(new Number(1)) !== false) { + $ERROR('#14: !(new Number(1)) === false. Actual: ' + (!(new Number(1)))); +} + +// CHECK#15 +if (!(new Number(Number.POSITIVE_INFINITY)) !== false) { + $ERROR('#15: !(new Number(Number.POSITIVE_INFINITY)) === false. Actual: ' + (!(new Number(Number.POSITIVE_INFINITY)))); +} + +// CHECK#16 +if (!(new Number(Number.NEGATIVE_INFINITY)) !== false) { + $ERROR('#16: !(new Number(Number.NEGATIVE_INFINITY)) === false. Actual: ' + (!(new Number(Number.NEGATIVE_INFINITY)))); +} + +// CHECK#17 +if (!(new Function()) !== false) { + $ERROR('#17: !(new Function()) === false. Actual: ' + (!(new Function()))); +} + +// CHECK#18 +if (!(new Date()) !== false) { + $ERROR('#18: !(new Date()) === false. Actual: ' + (!(new Date()))); +} + +// CHECK#19 +if (!(new Date(0)) !== false) { + $ERROR('#19: !(new Date(0)) === false. Actual: ' + (!(new Date(0)))); +} + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/bigint.js b/js/src/tests/test262/language/expressions/logical-not/bigint.js new file mode 100644 index 0000000000..b67471f85f --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/bigint.js @@ -0,0 +1,25 @@ +// Copyright (C) 2017 Robin Templeton. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Conversion of BigInt values to booleans +esid: sec-logical-not-operator-runtime-semantics-evaluation +info: | + UnaryExpression: ! UnaryExpression + + 1. Let expr be the result of evaluating UnaryExpression. + 2. Let oldValue be ToBoolean(? GetValue(expr)). + 3. If oldValue is true, return false. + 4. Return true. + + ToBoolean ( argument ) + + BigInt: Return false if argument is 0n; otherwise return true. +features: [BigInt] +---*/ + +assert.sameValue(!0n, true, "!0n"); +assert.sameValue(!1n, false, "!1n"); +assert.sameValue(!-1n, false, "!-1n"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/language/expressions/logical-not/browser.js b/js/src/tests/test262/language/expressions/logical-not/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/browser.js diff --git a/js/src/tests/test262/language/expressions/logical-not/shell.js b/js/src/tests/test262/language/expressions/logical-not/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/shell.js diff --git a/js/src/tests/test262/language/expressions/logical-not/symbol-logical-not-evaluation.js b/js/src/tests/test262/language/expressions/logical-not/symbol-logical-not-evaluation.js new file mode 100644 index 0000000000..28bb043c01 --- /dev/null +++ b/js/src/tests/test262/language/expressions/logical-not/symbol-logical-not-evaluation.js @@ -0,0 +1,22 @@ +// Copyright (C) 2013 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 12.5.12.1 +description: > + "Logical Not" coercion operation on Symbols +features: [Symbol] +---*/ +var sym = Symbol(); + +assert.sameValue(!sym, false, "`!sym` is `false`"); +assert.sameValue(!!sym, true, "`!!sym` is `true`"); + +if (!sym) { + $ERROR("ToBoolean(Symbol) always returns `true`"); +} else if (sym) { + assert(true, "`sym` evaluates to `true`"); +} else { + $ERROR("ToBoolean(Symbol) always returns `true`"); +} + +reportCompare(0, 0); |