diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/jit-test/tests/basic/bug507180.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/basic/bug507180.js')
-rw-r--r-- | js/src/jit-test/tests/basic/bug507180.js | 69 |
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 0000000000..9d8fb19580 --- /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(); |