summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/unary-plus
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/language/expressions/unary-plus
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/expressions/unary-plus')
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/11.4.6-2-1.js11
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A1.js62
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.1_T1.js39
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.1_T2.js21
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.2_T1.js79
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T1.js20
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T2.js20
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T3.js35
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T4.js20
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T5.js20
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/S9.3_A1_T2.js25
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/S9.3_A2_T2.js19
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/S9.3_A3_T2.js26
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/S9.3_A4.1_T2.js34
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/S9.3_A4.2_T2.js58
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/S9.3_A5_T2.js129
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/bigint-throws.js33
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/unary-plus/shell.js0
19 files changed, 651 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/unary-plus/11.4.6-2-1.js b/js/src/tests/test262/language/expressions/unary-plus/11.4.6-2-1.js
new file mode 100644
index 0000000000..ccc933af23
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/11.4.6-2-1.js
@@ -0,0 +1,11 @@
+// Copyright (c) 2012 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+es5id: 11.4.6-2-1
+description: +"" should be zero
+---*/
+
+assert.sameValue(+"", 0, '+""');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A1.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A1.js
new file mode 100644
index 0000000000..b5d7e718d5
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_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.6_A1
+description: Checking by using eval
+---*/
+
+//CHECK#1
+if (eval("+\u00091") !== 1) {
+ throw new Test262Error('#1: +\\u00091 === 1');
+}
+
+//CHECK#2
+if (eval("+\u000B1") !== 1) {
+ throw new Test262Error('#2: +\\u000B1 === 1');
+}
+
+//CHECK#3
+if (eval("+\u000C1") !== 1) {
+ throw new Test262Error('#3: +\\u000C1 === 1');
+}
+
+//CHECK#4
+if (eval("+\u00201") !== 1) {
+ throw new Test262Error('#4: +\\u0020 === 1');
+}
+
+//CHECK#5
+if (eval("+\u00A01") !== 1) {
+ throw new Test262Error('#5: +\\u00A01 === 1');
+}
+
+//CHECK#6
+if (eval("+\u000A1") !== 1) {
+ throw new Test262Error('#6: +\\u000A1 === 1');
+}
+
+//CHECK#7
+if (eval("+\u000D1") !== 1) {
+ throw new Test262Error('#7: +\\u000D1 === 1');
+}
+
+//CHECK#8
+if (eval("+\u20281") !== 1) {
+ throw new Test262Error('#8: +\\u20281 === 1');
+}
+
+//CHECK#9
+if (eval("+\u20291") !== 1) {
+ throw new Test262Error('#9: +\\u20291 === 1');
+}
+
+//CHECK#10
+if (eval("+\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291") !== 1) {
+ throw new Test262Error('#10: +\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291 === 1');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.1_T1.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.1_T1.js
new file mode 100644
index 0000000000..662355b2fe
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_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.6_A2.1_T1
+description: Either Type(x) is not Reference or GetBase(x) is not null
+---*/
+
+//CHECK#1
+if (+1 !== 1) {
+ throw new Test262Error('#1: +1 === 1. Actual: ' + (+1));
+}
+
+//CHECK#2
+if (+(+1) !== 1) {
+ throw new Test262Error('#2: +(+1) === -1. Actual: ' + (+(+1)));
+}
+
+//CHECK#3
+var x = 1;
+if (+x !== 1) {
+ throw new Test262Error('#3: var x = +1; -x === 1. Actual: ' + (-x));
+}
+
+//CHECK#4
+var x = 1;
+if (+(+x) !== 1) {
+ throw new Test262Error('#4: var x = 1; +(+x) === 1. Actual: ' + (+(+x)));
+}
+
+//CHECK#5
+var object = new Object();
+object.prop = 1;
+if (+object.prop !== 1) {
+ throw new Test262Error('#5: var object = new Object(); object.prop = 1; +object.prop === 1. Actual: ' + (+object.prop));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.1_T2.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.1_T2.js
new file mode 100644
index 0000000000..00b3a7cef8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_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.6_A2.1_T2
+description: If GetBase(x) is null, throw ReferenceError
+---*/
+
+//CHECK#1
+try {
+ +x;
+ throw new Test262Error('#1.1: +x throw ReferenceError. Actual: ' + (+x));
+}
+catch (e) {
+ if ((e instanceof ReferenceError) !== true) {
+ throw new Test262Error('#1.2: +x throw ReferenceError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.2_T1.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A2.2_T1.js
new file mode 100644
index 0000000000..d1f389d5eb
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_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.
+
+/*---
+info: Operator +x uses [[Default Value]]
+es5id: 11.4.6_A2.2_T1
+description: If Type(value) is Object, evaluate ToPrimitive(value, Number)
+---*/
+
+//CHECK#1
+var object = {valueOf: function() {return 1}};
+if (+object !== 1) {
+ throw new Test262Error('#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) {
+ throw new Test262Error('#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) {
+ throw new Test262Error('#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) {
+ throw new Test262Error('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; +object === 1. Actual: ' + (+object));
+ }
+}
+catch (e) {
+ if (e === "error") {
+ throw new Test262Error('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; +object not throw "error"');
+ } else {
+ throw new Test262Error('#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) {
+ throw new Test262Error('#5: var object = {toString: function() {return 1}}; +object === 1. Actual: ' + (+object));
+}
+
+//CHECK#6
+var object = {valueOf: function() {return {}}, toString: function() {return 1}}
+if (+object !== 1) {
+ throw new Test262Error('#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;
+ throw new Test262Error('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; +object throw "error". Actual: ' + (+object));
+}
+catch (e) {
+ if (e !== "error") {
+ throw new Test262Error('#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;
+ throw new Test262Error('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; +object throw TypeError. Actual: ' + (+object));
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; +object throw TypeError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T1.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T1.js
new file mode 100644
index 0000000000..247956659f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_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.
+
+/*---
+info: Operator +x returns ToNumber(x)
+es5id: 11.4.6_A3_T1
+description: Type(x) is boolean primitive or Boolean object
+---*/
+
+//CHECK#1
+if (+false !== 0) {
+ throw new Test262Error('#1: +false === 0. Actual: ' + (+false));
+}
+
+//CHECK#2
+if (+new Boolean(true) !== 1) {
+ throw new Test262Error('#2: +new Boolean(true) === 1. Actual: ' + (+new Boolean(true)));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T2.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T2.js
new file mode 100644
index 0000000000..4bdd74e78e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_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: Operator +x returns ToNumber(x)
+es5id: 11.4.6_A3_T2
+description: Type(x) is number primitive or Number object
+---*/
+
+//CHECK#1
+if (+0.1 !== 0.1) {
+ throw new Test262Error('#1: +0.1 === 0.1. Actual: ' + (+0.1));
+}
+
+//CHECK#2
+if (+new Number(-1.1) !== -1.1) {
+ throw new Test262Error('#2: +new Number(-1.1) === -1.1. Actual: ' + (+new Number(-1.1)));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T3.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T3.js
new file mode 100644
index 0000000000..906bb290ea
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_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 ToNumber(x)
+es5id: 11.4.6_A3_T3
+description: Type(x) is string primitive or String object
+---*/
+
+//CHECK#1
+if (+"1" !== 1) {
+ throw new Test262Error('#1: +"1" === 1. Actual: ' + (+"1"));
+}
+
+//CHECK#2
+if (+new Number("-1") !== -1) {
+ throw new Test262Error('#2: +new String("-1") === -1. Actual: ' + (+new String("-1")));
+}
+
+//CHECK#3
+if (isNaN(+"x") !== true) {
+ throw new Test262Error('#3: +"x" === Not-a-Number. Actual: ' + (+"x"));
+}
+
+//CHECK#4
+if (isNaN(+"INFINITY") !== true) {
+ throw new Test262Error('#4: +"INFINITY" === Not-a-Number. Actual: ' + (+"INFINITY"));
+}
+
+//CHECK#5
+if (isNaN(+"infinity") !== true) {
+ throw new Test262Error('#5: +"infinity" === Not-a-Number. Actual: ' + (+"infinity"));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T4.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T4.js
new file mode 100644
index 0000000000..67b34ef740
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_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 ToNumber(x)
+es5id: 11.4.6_A3_T4
+description: Type(x) is undefined or null
+---*/
+
+//CHECK#1
+if (isNaN(+void 0) !== true) {
+ throw new Test262Error('#1: +void 0 === Not-a-Number. Actual: ' + (+void 0));
+}
+
+//CHECK#2
+if (+null !== 0) {
+ throw new Test262Error('#2: +null === 0. Actual: ' + (+null));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T5.js b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_A3_T5.js
new file mode 100644
index 0000000000..6d4a9e75c5
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/S11.4.6_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 ToNumber(x)
+es5id: 11.4.6_A3_T5
+description: Type(x) is Object object or Function object
+---*/
+
+//CHECK#1
+if (isNaN(+{}) !== true) {
+ throw new Test262Error('#1: +{} === Not-a-Number. Actual: ' + (+{}));
+}
+
+//CHECK#2
+if (isNaN(+function(){return 1}) !== true) {
+ throw new Test262Error('#2: +function(){return 1} === Not-a-Number. Actual: ' + (+function(){return 1}));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/S9.3_A1_T2.js b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A1_T2.js
new file mode 100644
index 0000000000..b0e827c741
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A1_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.
+
+/*---
+info: Result of number conversion from undefined value is NaN
+es5id: 9.3_A1_T2
+description: Undefined convert to Number by implicit transformation
+---*/
+
+// CHECK#1
+if (isNaN(+(undefined)) !== true) {
+ throw new Test262Error('#1: +(undefined) === Not-a-Number. Actual: ' + (+(undefined)));
+}
+
+// CHECK#2
+if (isNaN(+(void 0)) !== true) {
+ throw new Test262Error('#2: +(void 0) === Not-a-Number. Actual: ' + (+(void 0)));
+}
+
+// CHECK#3
+if (isNaN(+(eval("var x"))) !== true) {
+ throw new Test262Error('#3: +(eval("var x")) === Not-a-Number. Actual: ' + (+(eval("var x"))));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/S9.3_A2_T2.js b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A2_T2.js
new file mode 100644
index 0000000000..7f0f29a1d1
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A2_T2.js
@@ -0,0 +1,19 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Result of number conversion from null value is +0
+es5id: 9.3_A2_T2
+description: null convert to Number by implicit transformation
+---*/
+
+// CHECK #1
+if (+(null) !== 0) {
+ throw new Test262Error('#1.1: +(null) === 0. Actual: ' + (+(null)));
+} else {
+ if (1/+(null) !== Number.POSITIVE_INFINITY) {
+ throw new Test262Error('#1.2: +(null) === +0. Actual: -0');
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/S9.3_A3_T2.js b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A3_T2.js
new file mode 100644
index 0000000000..6503a0e1c2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A3_T2.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.
+
+/*---
+info: |
+ Result of number conversion from boolean value is 1 if the argument is
+ true, else is +0
+es5id: 9.3_A3_T2
+description: False and true convert to Number by implicit transformation
+---*/
+
+// CHECK#1
+if (+(false) !== +0) {
+ throw new Test262Error('#1.1: +(false) === 0. Actual: ' + (+(false)));
+} else {
+ if (1/+(false) !== Number.POSITIVE_INFINITY) {
+ throw new Test262Error('#1.2: +(false) === +0. Actual: -0');
+ }
+}
+
+// CHECK#2
+if (+(true) !== 1) {
+ throw new Test262Error('#2: +(true) === 1. Actual: ' + (+(true)));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/S9.3_A4.1_T2.js b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A4.1_T2.js
new file mode 100644
index 0000000000..a41798df50
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A4.1_T2.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.
+
+/*---
+info: |
+ Result of number conversion from number value equals to the input
+ argument (no conversion)
+es5id: 9.3_A4.1_T2
+description: >
+ Some numbers including Number.MAX_VALUE and Number.MIN_VALUE are
+ converted to Number with implicit transformation
+---*/
+
+// CHECK#1
+if (+(13) !== 13) {
+ throw new Test262Error('#1: +(13) === 13. Actual: ' + (+(13)));
+}
+
+// CHECK#2
+if (+(-13) !== -13) {
+ throw new Test262Error('#2: +(-13) === -13. Actual: ' + (+(-13)));
+}
+
+// CHECK#3
+if (+(1.3) !== 1.3) {
+ throw new Test262Error('#3: +(1.3) === 1.3. Actual: ' + (+(1.3)));
+}
+
+// CHECK#4
+if (+(-1.3) !== -1.3) {
+ throw new Test262Error('#4: +(-1.3) === -1.3. Actual: ' + (+(-1.3)));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/S9.3_A4.2_T2.js b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A4.2_T2.js
new file mode 100644
index 0000000000..312768bc1c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A4.2_T2.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: |
+ Result of number conversion from number value equals to the input
+ argument (no conversion)
+es5id: 9.3_A4.2_T2
+description: >
+ Number.NaN, +0, -0, Number.POSITIVE_INFINITY,
+ Number.NEGATIVE_INFINITY, Number.MAX_VALUE and Number.MIN_VALUE
+ convert to Number by implicit transformation
+---*/
+
+// CHECK#1
+if (isNaN(+(Number.NaN)) !== true) {
+ throw new Test262Error('#1: +(NaN) === Not-a-Number. Actual: ' + (+(NaN)));
+}
+
+// CHECK#2
+if (+(+0) !== +0) {
+ throw new Test262Error('#2.1: +(+0) === 0. Actual: ' + (+(+0)));
+} else {
+ if (1/+(+0) !== Number.POSITIVE_INFINITY) {
+ throw new Test262Error('#2.2: +(+0) === +0. Actual: -0');
+ }
+}
+
+// CHECK#3
+if (+(-0) !== -0) {
+ throw new Test262Error('#3.1: +(-0) === 0. Actual: ' + (+(-0)));
+} else {
+ if (1/+(-0) !== Number.NEGATIVE_INFINITY) {
+ throw new Test262Error('#3.2: +(-0) === -0. Actual: +0');
+ }
+}
+
+// CHECK#4
+if (+(Number.POSITIVE_INFINITY) !== Number.POSITIVE_INFINITY) {
+ throw new Test262Error('#4: +(+Infinity) === +Infinity. Actual: ' + (+(+Infinity)));
+}
+
+// CHECK#5
+if (+(Number.NEGATIVE_INFINITY) !== Number.NEGATIVE_INFINITY) {
+ throw new Test262Error('#5: +(-Infinity) === -Infinity. Actual: ' + (+(-Infinity)));
+}
+
+// CHECK#6
+if (+(Number.MAX_VALUE) !== Number.MAX_VALUE) {
+ throw new Test262Error('#6: +(Number.MAX_VALUE) === Number.MAX_VALUE. Actual: ' + (+(Number.MAX_VALUE)));
+}
+
+// CHECK#7
+if (+(Number.MIN_VALUE) !== Number.MIN_VALUE) {
+ throw new Test262Error('#7: +(Number.MIN_VALUE) === Number.MIN_VALUE. Actual: ' + (+(Number.MIN_VALUE)));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/S9.3_A5_T2.js b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A5_T2.js
new file mode 100644
index 0000000000..f102ab3e7b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/S9.3_A5_T2.js
@@ -0,0 +1,129 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Result of number conversion from object value is the result
+ of conversion from primitive value
+es5id: 9.3_A5_T2
+description: >
+ new Number(), new Number(0), new Number(Number.NaN), new
+ Number(null), new Number(void 0) and others convert to Number by
+ implicit transformation
+---*/
+
+// CHECK#1
+if (+(new Number()) !== 0) {
+ throw new Test262Error('#1: +(new Number()) === 0. Actual: ' + (+(new Number())));
+}
+
+// CHECK#2
+if (+(new Number(0)) !== 0) {
+ throw new Test262Error('#2: +(new Number(0)) === 0. Actual: ' + (+(new Number(0))));
+}
+
+// CHECK#3
+if (isNaN(+(new Number(Number.NaN)) !== true)) {
+ throw new Test262Error('#3: +(new Number(Number.NaN)) === Not-a-Number. Actual: ' + (+(new Number(Number.NaN))));
+}
+
+// CHECK#4
+if (+(new Number(null)) !== 0) {
+ throw new Test262Error('#4.1: +(new Number(null)) === 0. Actual: ' + (+(new Number(null))));
+} else {
+ if (1/+(new Number(null)) !== Number.POSITIVE_INFINITY) {
+ throw new Test262Error('#4.2: +(new Number(null)) === +0. Actual: -0');
+ }
+}
+
+// CHECK#5
+if (isNaN(+(new Number(void 0)) !== true)) {
+ throw new Test262Error('#5: +(new Number(void 0)) === Not-a-Number. Actual: ' + (+(new Number(void 0))));
+}
+
+// CHECK#6
+if (+(new Number(true)) !== 1) {
+ throw new Test262Error('#6: +(new Number(true)) === 1. Actual: ' + (+(new Number(true))));
+}
+
+// CHECK#7
+if (+(new Number(false)) !== +0) {
+ throw new Test262Error('#7.1: +(new Number(false)) === 0. Actual: ' + (+(new Number(false))));
+} else {
+ if (1/+(new Number(false)) !== Number.POSITIVE_INFINITY) {
+ throw new Test262Error('#7.2: +(new Number(false)) === +0. Actual: -0');
+ }
+}
+
+// CHECK#8
+if (+(new Boolean(true)) !== 1) {
+ throw new Test262Error('#8: +(new Boolean(true)) === 1. Actual: ' + (+(new Boolean(true))));
+}
+
+// CHECK#9
+if (+(new Boolean(false)) !== +0) {
+ throw new Test262Error('#9.1: +(new Boolean(false)) === 0. Actual: ' + (+(new Boolean(false))));
+} else {
+ if (1/+(new Boolean(false)) !== Number.POSITIVE_INFINITY) {
+ throw new Test262Error('#9.2: +(new Boolean(false)) === +0. Actual: -0');
+ }
+}
+
+// CHECK#10
+if (isNaN(+(new Array(2,4,8,16,32))) !== true) {
+ throw new Test262Error('#10: +(new Array(2,4,8,16,32)) === Not-a-Number. Actual: ' + (+(new Array(2,4,8,16,32))));
+}
+
+// CHECK#11
+var myobj1 = {
+ ToNumber : function(){return 12345;},
+ toString : function(){return "67890";},
+ valueOf : function(){return "[object MyObj]";}
+ };
+
+if (isNaN(+(myobj1)) !== true){
+ throw new Test262Error("#11: +(myobj1) calls ToPrimitive with hint +. Exptected: Not-a-Number. Actual: " + (+(myobj1)));
+}
+
+// CHECK#12
+var myobj2 = {
+ ToNumber : function(){return 12345;},
+ toString : function(){return "67890";},
+ valueOf : function(){return "9876543210";}
+ };
+
+if (+(myobj2) !== 9876543210){
+ throw new Test262Error("#12: +(myobj2) calls ToPrimitive with hint +. Exptected: 9876543210. Actual: " + (+(myobj2)));
+}
+
+
+// CHECK#13
+var myobj3 = {
+ ToNumber : function(){return 12345;},
+ toString : function(){return "[object MyObj]";}
+ };
+
+if (isNaN(+(myobj3)) !== true){
+ throw new Test262Error("#13: +(myobj3) calls ToPrimitive with hint +. Exptected: Not-a-Number. Actual: " + (+(myobj3)));
+}
+
+// CHECK#14
+var myobj4 = {
+ ToNumber : function(){return 12345;},
+ toString : function(){return "67890";}
+ };
+
+if (+(myobj4) !== 67890){
+ throw new Test262Error("#14: +(myobj4) calls ToPrimitive with hint +. Exptected: 67890. Actual: " + (+(myobj4)));
+}
+
+// CHECK#15
+var myobj5 = {
+ ToNumber : function(){return 12345;}
+ };
+
+if (isNaN(+(myobj5)) !== true){
+ throw new Test262Error("#15: +(myobj5) calls ToPrimitive with hint +. Exptected: 12345. Actual: " + (+(myobj5)));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/bigint-throws.js b/js/src/tests/test262/language/expressions/unary-plus/bigint-throws.js
new file mode 100644
index 0000000000..a7587706d8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/bigint-throws.js
@@ -0,0 +1,33 @@
+// Copyright (C) 2017 Robin Templeton. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: The Unary + Operator throws a TypeError on BigInt numbers
+esid: sec-unary-plus-operator-runtime-semantics-evaluation
+info: |
+ UnaryExpression: + UnaryExpression
+
+ 1. Let expr be the result of evaluating UnaryExpression.
+ 2. Return ? ToNumber(? GetValue(expr)).
+
+ ToNumber ( argument )
+
+ BigInt: Throw a TypeError exception
+features: [BigInt]
+---*/
+assert.throws(TypeError, function() {
+ +0n;
+}, '+0n throws TypeError');
+
+assert.throws(TypeError, function() {
+ +1n;
+}, '+1n throws TypeError');
+
+assert.throws(TypeError, function() {
+ +-1n;
+}, '+-1n throws TypeError');
+
+assert.throws(TypeError, function() {
+ +1000000000000000n;
+}, '+1000000000000000n throws TypeError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/unary-plus/browser.js b/js/src/tests/test262/language/expressions/unary-plus/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/browser.js
diff --git a/js/src/tests/test262/language/expressions/unary-plus/shell.js b/js/src/tests/test262/language/expressions/unary-plus/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/unary-plus/shell.js