summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/ch11/11.4/11.4.7
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/tests/test262/ch11/11.4/11.4.7
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/test262/ch11/11.4/11.4.7')
-rw-r--r--js/src/tests/test262/ch11/11.4/11.4.7/11.4.7-4-1.js15
-rw-r--r--js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A1.js60
-rw-r--r--js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.1_T1.js39
-rw-r--r--js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.1_T2.js22
-rw-r--r--js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.2_T1.js79
-rw-r--r--js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T1.js20
-rw-r--r--js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T2.js20
-rw-r--r--js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T3.js25
-rw-r--r--js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T4.js20
-rw-r--r--js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T5.js20
-rw-r--r--js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A4.1.js21
-rw-r--r--js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A4.2.js33
-rw-r--r--js/src/tests/test262/ch11/11.4/11.4.7/browser.js0
-rw-r--r--js/src/tests/test262/ch11/11.4/11.4.7/shell.js0
14 files changed, 374 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/11.4.7-4-1.js b/js/src/tests/test262/ch11/11.4/11.4.7/11.4.7-4-1.js
new file mode 100644
index 000000000..12d050866
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.4/11.4.7/11.4.7-4-1.js
@@ -0,0 +1,15 @@
+/// Copyright (c) 2012 Ecma International. All rights reserved.
+/// Ecma International makes this code available under the terms and conditions set
+/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
+/// "Use Terms"). Any redistribution of this code must retain the above
+/// copyright and this notice and otherwise comply with the Use Terms.
+/**
+ * @path ch11/11.4/11.4.7/11.4.7-4-1.js
+ * @description -"" should be zero
+ */
+
+
+function testcase() {
+ return -"" === 0;
+ }
+runTestCase(testcase);
diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A1.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A1.js
new file mode 100644
index 000000000..13234518b
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A1.js
@@ -0,0 +1,60 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * White Space and Line Terminator between "-" and UnaryExpression are allowed
+ *
+ * @path ch11/11.4/11.4.7/S11.4.7_A1.js
+ * @description Checking by using eval
+ */
+
+//CHECK#1
+if (eval("-\u00091") !== -1) {
+ $ERROR('#1: -\\u00091 === -1');
+}
+
+//CHECK#2
+if (eval("-\u000B1") !== -1) {
+ $ERROR('#2: -\\u000B1 === -1');
+}
+
+//CHECK#3
+if (eval("-\u000C1") !== -1) {
+ $ERROR('#3: -\\u000C1 === -1');
+}
+
+//CHECK#4
+if (eval("-\u00201") !== -1) {
+ $ERROR('#4: -\\u0020 === -1');
+}
+
+//CHECK#5
+if (eval("-\u00A01") !== -1) {
+ $ERROR('#5: -\\u00A01 === -1');
+}
+
+//CHECK#6
+if (eval("-\u000A1") !== -1) {
+ $ERROR('#6: -\\u000A1 === -1');
+}
+
+//CHECK#7
+if (eval("-\u000D1") !== -1) {
+ $ERROR('#7: -\\u000D1 === -1');
+}
+
+//CHECK#8
+if (eval("-\u20281") !== -1) {
+ $ERROR('#8: -\\u20281 === -1');
+}
+
+//CHECK#9
+if (eval("-\u20291") !== -1) {
+ $ERROR('#9: -\\u20291 === -1');
+}
+
+//CHECK#10
+if (eval("-\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== -1) {
+ $ERROR('#10: -\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === -1');
+}
+
diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.1_T1.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.1_T1.js
new file mode 100644
index 000000000..8b3c47a90
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_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.
+
+/**
+ * Operator -x uses GetValue
+ *
+ * @path ch11/11.4/11.4.7/S11.4.7_A2.1_T1.js
+ * @description Either Type(x) is not Reference or GetBase(x) is not null
+ */
+
+//CHECK#1
+if (-1 !== -1) {
+ $ERROR('#1: -1 === -1. Actual: ' + (-1));
+}
+
+//CHECK#2
+if (-(-1) !== 1) {
+ $ERROR('#2: -(-1) === -1. Actual: ' + (-(-1)));
+}
+
+//CHECK#3
+var x = -1;
+if (-x !== 1) {
+ $ERROR('#3: var x = -1; -x === 1. Actual: ' + (-x));
+}
+
+//CHECK#4
+var x = -1;
+if (-(-x) !== -1) {
+ $ERROR('#4: var x = -1; -(-x) === -1. Actual: ' + (-(-x)));
+}
+
+//CHECK#5
+var object = new Object();
+object.prop = 1;
+if (-object.prop !== -1) {
+ $ERROR('#5: var object = new Object(); object.prop = -1; -object.prop === -1. Actual: ' + (-object.prop));
+}
+
diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.1_T2.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.1_T2.js
new file mode 100644
index 000000000..e7de28aa5
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.1_T2.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.
+
+/**
+ * Operator -x uses GetValue
+ *
+ * @path ch11/11.4/11.4.7/S11.4.7_A2.1_T2.js
+ * @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));
+ }
+}
+
+
diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.2_T1.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.2_T1.js
new file mode 100644
index 000000000..a9ad69e5c
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A2.2_T1.js
@@ -0,0 +1,79 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * Operator -x uses [[Default Value]]
+ *
+ * @path ch11/11.4/11.4.7/S11.4.7_A2.2_T1.js
+ * @description If Type(value) is Object, evaluate ToPrimitive(value, Number)
+ */
+
+//CHECK#1
+var object = {valueOf: function() {return -1}};
+if (-object !== 1) {
+ $ERROR('#1: var object = {valueOf: function() {return -1}}; -object === 1. Actual: ' + (-object));
+}
+
+//CHECK#2
+var object = {valueOf: function() {return -1}, toString: function() {return 0}};
+if (-object !== 1) {
+ $ERROR('#2: var object = {valueOf: function() {return -1}, toString: function() {return 0}}; -object === 1. Actual: ' + (-object));
+}
+
+//CHECK#3
+var object = {valueOf: function() {return -1}, toString: function() {return {}}};
+if (-object !== 1) {
+ $ERROR('#3: var object = {valueOf: function() {return -1}, toString: function() {return {}}}; -object === 1. Actual: ' + (-object));
+}
+
+//CHECK#4
+try {
+ var object = {valueOf: function() {return -1}, toString: function() {throw "error"}};
+ if (-object !== 1) {
+ $ERROR('#4.1: var object = {valueOf: function() {return -1}, toString: function() {throw "error"}}; -object === 1. Actual: ' + (-object));
+ }
+}
+catch (e) {
+ if (e === "error") {
+ $ERROR('#4.2: var object = {valueOf: function() {return -1}, toString: function() {throw "error"}}; -object not throw "error"');
+ } else {
+ $ERROR('#4.3: var object = {valueOf: function() {return -1}, toString: function() {throw "error"}}; -object not throw Error. Actual: ' + (e));
+ }
+}
+
+//CHECK#5
+var object = {toString: function() {return -1}};
+if (-object !== 1) {
+ $ERROR('#5.1: var object = {toString: function() {return -1}}; -object === 1. Actual: ' + (-object));
+}
+
+//CHECK#6
+var object = {valueOf: function() {return {}}, toString: function() {return -1}}
+if (-object !== 1) {
+ $ERROR('#6: var object = {valueOf: function() {return {}}, toString: function() {return -1}}; -object === 1. Actual: ' + (-object));
+}
+
+//CHECK#7
+try {
+ var object = {valueOf: function() {throw "error"}, toString: function() {return -1}};
+ -object;
+ $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return -1}}; -object throw "error". Actual: ' + (-object));
+}
+catch (e) {
+ if (e !== "error") {
+ $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return -1}}; -object throw "error". Actual: ' + (e));
+ }
+}
+
+//CHECK#8
+try {
+ var object = {valueOf: function() {return {}}, toString: function() {return {}}};
+ -object;
+ $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; -object throw TypeError. Actual: ' + (-object));
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; -object throw TypeError. Actual: ' + (e));
+ }
+}
+
diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T1.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T1.js
new file mode 100644
index 000000000..f421d9133
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_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.
+
+/**
+ * Operator -x returns -ToNumber(x)
+ *
+ * @path ch11/11.4/11.4.7/S11.4.7_A3_T1.js
+ * @description Type(x) is boolean primitive or Boolean object
+ */
+
+//CHECK#1
+if (-false !== 0) {
+ $ERROR('#1: -false === 0. Actual: ' + (-false));
+}
+
+//CHECK#2
+if (-new Boolean(true) !== -1) {
+ $ERROR('#2: -new Boolean(true) === -1. Actual: ' + (-new Boolean(true)));
+}
+
diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T2.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T2.js
new file mode 100644
index 000000000..611683c12
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_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.
+
+/**
+ * Operator -x returns -ToNumber(x)
+ *
+ * @path ch11/11.4/11.4.7/S11.4.7_A3_T2.js
+ * @description Type(x) is number primitive or Number object
+ */
+
+//CHECK#1
+if (-(1) !== -1) {
+ $ERROR('#1: -(1) === -1. Actual: ' + (-(1)));
+}
+
+//CHECK#2
+if (-new Number(-1) !== 1) {
+ $ERROR('#2: -new Number(-1) === 1. Actual: ' + (-new Number(-1)));
+}
+
diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T3.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T3.js
new file mode 100644
index 000000000..9a439804e
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T3.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.
+
+/**
+ * Operator -x returns -ToNumber(x)
+ *
+ * @path ch11/11.4/11.4.7/S11.4.7_A3_T3.js
+ * @description Type(x) is string primitive or String object
+ */
+
+//CHECK#1
+if (-"1" !== -1) {
+ $ERROR('#1: -"1" === -1. Actual: ' + (-"1"));
+}
+
+//CHECK#2
+if (isNaN(-"x") !== true) {
+ $ERROR('#2: -"x" === Not-a-Number. Actual: ' + (-"x"));
+}
+
+//CHECK#3
+if (-new String("-1") !== 1) {
+ $ERROR('#3: -new String("-1") === 1. Actual: ' + (-new String("-1")));
+}
+
diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T4.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T4.js
new file mode 100644
index 000000000..7fda40e95
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_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.
+
+/**
+ * Operator -x returns -ToNumber(x)
+ *
+ * @path ch11/11.4/11.4.7/S11.4.7_A3_T4.js
+ * @description Type(x) is undefined or null
+ */
+
+//CHECK#1
+if (isNaN(-void 0) !== true) {
+ $ERROR('#1: +void 0 === Not-a-Number. Actual: ' + (+void 0));
+}
+
+//CHECK#2
+if (-null !== 0) {
+ $ERROR('#2: +null === 0. Actual: ' + (+null));
+}
+
diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T5.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A3_T5.js
new file mode 100644
index 000000000..426a4fd8b
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_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.
+
+/**
+ * Operator -x returns -ToNumber(x)
+ *
+ * @path ch11/11.4/11.4.7/S11.4.7_A3_T5.js
+ * @description Type(x) is Object object or Function object
+ */
+
+//CHECK#1
+if (isNaN(-{}) !== true) {
+ $ERROR('#1: -{} === Not-a-Number. Actual: ' + (-{}));
+}
+
+//CHECK#2
+if (isNaN(-function(){return 1}) !== true) {
+ $ERROR('#2: -function(){return 1} === Not-a-Number. Actual: ' + (-function(){return 1}));
+}
+
diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A4.1.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A4.1.js
new file mode 100644
index 000000000..e8d1dfe86
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A4.1.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.
+
+/**
+ * If x is NaN, operator -x returns NaN
+ *
+ * @path ch11/11.4/11.4.7/S11.4.7_A4.1.js
+ * @description Checking NaN
+ */
+
+//CHECK#1
+if (isNaN(-NaN) !== true) {
+ $ERROR('#1: -NaN === Not-a-Number. Actual: ' + (-NaN));
+}
+
+//CHECK#2
+var x = NaN;
+if (isNaN(-x) != true) {
+ $ERROR('#2: var x = NaN; -x === Not-a-Number. Actual: ' + (-x));
+}
+
diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A4.2.js b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A4.2.js
new file mode 100644
index 000000000..8b39bd249
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.4/11.4.7/S11.4.7_A4.2.js
@@ -0,0 +1,33 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/**
+ * Negating +0 produces -0, negating -0 produces +0
+ *
+ * @path ch11/11.4/11.4.7/S11.4.7_A4.2.js
+ * @description Checking Infinity
+ */
+
+//CHECK#1
+var x = 0;
+x = -x;
+if (x !== -0) {
+ $ERROR('#1.1: var x = 0; x = -x; x === 0. Actual: ' + (x));
+} else {
+ if (1/x !== Number.NEGATIVE_INFINITY) {
+ $ERROR('#1.2: var x = 0; x = -x; x === - 0. Actual: +0');
+ }
+}
+
+//CHECK#2
+var x = -0;
+x = -x;
+if (x !== 0) {
+ $ERROR('#2.1: var x = -0; x = -x; x === 0. Actual: ' + (x));
+} else {
+ if (1/x !== Number.POSITIVE_INFINITY) {
+ $ERROR('#2.2: var x = -0; x = -x; x === + 0. Actual: -0');
+ }
+}
+
+
diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/browser.js b/js/src/tests/test262/ch11/11.4/11.4.7/browser.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.4/11.4.7/browser.js
diff --git a/js/src/tests/test262/ch11/11.4/11.4.7/shell.js b/js/src/tests/test262/ch11/11.4/11.4.7/shell.js
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/js/src/tests/test262/ch11/11.4/11.4.7/shell.js