summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/bug507180.js
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/jit-test/tests/basic/bug507180.js
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/jit-test/tests/basic/bug507180.js')
-rw-r--r--js/src/jit-test/tests/basic/bug507180.js69
1 files changed, 69 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/bug507180.js b/js/src/jit-test/tests/basic/bug507180.js
new file mode 100644
index 000000000..9d8fb1958
--- /dev/null
+++ b/js/src/jit-test/tests/basic/bug507180.js
@@ -0,0 +1,69 @@
+var o = {
+ valueOf : function() {
+ return {
+ toString : function() { return "fail" }
+ }
+ },
+ toString : function() { return "good" }
+};
+
+var p = {
+ valueOf : function() {
+ return {
+ toString : function() { return "0" }
+ }
+ },
+ toString : function() { return "7" }
+};
+
+var q = {
+ toString : function() {
+ return {
+ valueOf : function() { return "0" }
+ }
+ },
+ valueOf : function() { return "7" }
+};
+
+function assert(b, s) {
+ if (b)
+ return;
+ assertEq("imacro produces incorrect result for " + s, "fail");
+}
+
+function run() {
+ for (var i = 0; i < 5; ++i) {
+ // equality / inequality
+ assert(!(o == "fail"), "obj == any");
+ assert(!("fail" == o), "any == obj");
+ assert(!(o != "good"), "obj != any");
+ assert(!("good" != o), "any != obj");
+
+ // binary
+ assert(!((p | 3) != 7), "obj | any");
+ assert(!((3 | p) != 7), "any | obj");
+ assert(!((p | p) != 7), "obj | obj");
+ assert(!((p & 3) != 3), "obj & any");
+ assert(!((3 & p) != 3), "any & obj");
+ assert(!((p & p) != 7), "obj & obj");
+ assert(!((p * 3) != 21), "obj * any");
+ assert(!((3 * p) != 21), "any * obj");
+ assert(!((p * p) != 49), "obj * obj");
+
+ // addition
+ assert(!(o + "" != "good"), "obj + any");
+ assert(!("" + o != "good"), "any + obj");
+ assert(!(o + o != "goodgood"), "any + any");
+
+ // sign
+ assert(!(-p != -7), "-obj");
+ assert(!(+p != 7), "+obj");
+
+ // String
+ assert(!(String(q) != "7"), "String(obj)");
+ assert(!(new String(q) != "7"), "new String(obj)");
+ }
+ return true;
+}
+
+run();