summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/concatenation
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/concatenation
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/concatenation')
-rw-r--r--js/src/tests/test262/language/expressions/concatenation/S9.8_A1_T2.js27
-rw-r--r--js/src/tests/test262/language/expressions/concatenation/S9.8_A2_T2.js15
-rw-r--r--js/src/tests/test262/language/expressions/concatenation/S9.8_A3_T2.js22
-rw-r--r--js/src/tests/test262/language/expressions/concatenation/S9.8_A4_T2.js24
-rw-r--r--js/src/tests/test262/language/expressions/concatenation/S9.8_A5_T2.js93
-rw-r--r--js/src/tests/test262/language/expressions/concatenation/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/concatenation/shell.js0
7 files changed, 181 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/concatenation/S9.8_A1_T2.js b/js/src/tests/test262/language/expressions/concatenation/S9.8_A1_T2.js
new file mode 100644
index 0000000000..3e437f82ff
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/concatenation/S9.8_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 ToString conversion from undefined value is "undefined"
+es5id: 9.8_A1_T2
+description: >
+ Undefined values is undefined, void 0 and eval("var x"). Use
+ implicit transformation
+---*/
+
+// CHECK#1
+if (undefined + "" !== "undefined") {
+ throw new Test262Error('#1: undefined + "" === "undefined". Actual: ' + (undefined + ""));
+}
+
+// CHECK#2
+if (void 0 + "" !== "undefined") {
+ throw new Test262Error('#2: void 0 + "" === "undefined". Actual: ' + (void 0 + ""));
+}
+
+// CHECK#3
+if (eval("var x") + "" !== "undefined") {
+ throw new Test262Error('#3: eval("var x") + "" === "undefined". Actual: ' + (eval("var x") + ""));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/concatenation/S9.8_A2_T2.js b/js/src/tests/test262/language/expressions/concatenation/S9.8_A2_T2.js
new file mode 100644
index 0000000000..dd6ebcebff
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/concatenation/S9.8_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 ToString conversion from null value is "null"
+es5id: 9.8_A2_T2
+description: null convert to String by implicit transformation
+---*/
+
+// CHECK#1
+if (null + "" !== "null") {
+ throw new Test262Error('#1: null + "" === "null". Actual: ' + (null + ""));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/concatenation/S9.8_A3_T2.js b/js/src/tests/test262/language/expressions/concatenation/S9.8_A3_T2.js
new file mode 100644
index 0000000000..9eaf919e8c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/concatenation/S9.8_A3_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.
+
+/*---
+info: |
+ Result of ToString conversion from boolean value is "true" if
+ the argument is "true", else is "false"
+es5id: 9.8_A3_T2
+description: True and false convert to String by implicit transformation
+---*/
+
+// CHECK#1
+if (false + "" !== "false") {
+ throw new Test262Error('#1: false + "" === "false". Actual: ' + (false + ""));
+}
+
+// CHECK#2
+if (true + "" !== "true") {
+ throw new Test262Error('#2: true + "" === "true". Actual: ' + (true + ""));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/concatenation/S9.8_A4_T2.js b/js/src/tests/test262/language/expressions/concatenation/S9.8_A4_T2.js
new file mode 100644
index 0000000000..e73e78e90b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/concatenation/S9.8_A4_T2.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.
+
+/*---
+info: |
+ Result of String conversion from string value is the input argument (no
+ conversion)
+es5id: 9.8_A4_T2
+description: Some strings convert to String by implicit transformation
+---*/
+
+// CHECK#1
+var x1 = "abc";
+if (x1 + "" !== x1) {
+ throw new Test262Error('#1: "abc" + "" === "abc". Actual: ' + ("abc" + ""));
+}
+
+// CHECK#2
+var x2 = "abc";
+if (typeof x2 + "" !== typeof x2) {
+ throw new Test262Error('#2: typeof "abc" + "" === "string". Actual: ' + (typeof "abc" + ""));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/concatenation/S9.8_A5_T2.js b/js/src/tests/test262/language/expressions/concatenation/S9.8_A5_T2.js
new file mode 100644
index 0000000000..55e772e126
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/concatenation/S9.8_A5_T2.js
@@ -0,0 +1,93 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ Result of String conversion from Object value is conversion
+ from primitive value
+es5id: 9.8_A5_T2
+description: Some objects convert to String 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 (new Number(Number.NaN) + "" !== "NaN") {
+ throw new Test262Error('#3: new Number(Number.NaN) + "" === "NaN". Actual: ' + (new Number(Number.NaN) + ""));
+}
+
+// CHECK#4
+if (new Number(null) + "" !== "0") {
+ throw new Test262Error('#4: new Number(null) + "" === "0". Actual: ' + (new Number(null) + ""));
+}
+
+// CHECK#5
+if (new Number(void 0) + "" !== "NaN") {
+ throw new Test262Error('#5: new Number(void 0) + "" === "NaN. 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: new Number(false) + "" === "0". Actual: ' + (new Number(false) + ""));
+}
+
+// CHECK#8
+if (new Boolean(true) + "" !== "true") {
+ throw new Test262Error('#8: new Boolean(true) + "" === "true". Actual: ' + (new Boolean(true) + ""));
+}
+
+// CHECK#9
+if (new Boolean(false) + "" !== "false") {
+ throw new Test262Error('#9: Number(new Boolean(false)) === "false". Actual: ' + (Number(new Boolean(false))));
+}
+
+// CHECK#10
+if (new Array(2,4,8,16,32) + "" !== "2,4,8,16,32") {
+ throw new Test262Error('#10: new Array(2,4,8,16,32) + "" === "2,4,8,16,32". 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 (myobj1 + "" !== "[object MyObj]"){
+ throw new Test262Error('#11: myobj1 + "" calls ToPrimitive with hint Number. Exptected: "[object MyObj]". Actual: ' + (myobj1 + ""));
+}
+
+// CHECK#12
+var myobj2 = {
+ toNumber : function(){return 12345;},
+ toString : function(){return 67890},
+ valueOf : function(){return {}}
+ };
+
+if (myobj2 + "" !== "67890"){
+ throw new Test262Error('#12: myobj2 + "" calls ToPrimitive with hint Number. Exptected: "67890". Actual: ' + (myobj2 + ""));
+}
+
+// CHECK#13
+var myobj3 = {
+ toNumber : function(){return 12345;}
+ };
+
+if (myobj3 + "" !== "[object Object]"){
+ throw new Test262Error('#13: myobj3 + "" calls ToPrimitive with hint Number. Exptected: "[object Object]". Actual: ' + (myobj3 + ""));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/concatenation/browser.js b/js/src/tests/test262/language/expressions/concatenation/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/concatenation/browser.js
diff --git a/js/src/tests/test262/language/expressions/concatenation/shell.js b/js/src/tests/test262/language/expressions/concatenation/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/concatenation/shell.js