diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/comparisons.js | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/test/compress/comparisons.js b/test/compress/comparisons.js index 461f415c..bb140fd8 100644 --- a/test/compress/comparisons.js +++ b/test/compress/comparisons.js @@ -373,12 +373,55 @@ unsafe_indexOf: { unsafe: true, } input: { - if (Object.keys({ foo: 42 }).indexOf("foo") >= 0) console.log("PASS"); + var a = Object.keys({ foo: 42 }); + if (a.indexOf("bar") < 0) console.log("PASS"); + if (0 > a.indexOf("bar")) console.log("PASS"); + if (a.indexOf("foo") >= 0) console.log("PASS"); + if (0 <= a.indexOf("foo")) console.log("PASS"); + if (a.indexOf("foo") > -1) console.log("PASS"); + if (-1 < a.indexOf("foo")) console.log("PASS"); + if (a.indexOf("bar") == -1) console.log("PASS"); + if (-1 == a.indexOf("bar")) console.log("PASS"); + if (a.indexOf("bar") === -1) console.log("PASS"); + if (-1 === a.indexOf("bar")) console.log("PASS"); + if (a.indexOf("foo") != -1) console.log("PASS"); + if (-1 != a.indexOf("foo")) console.log("PASS"); + if (a.indexOf("foo") !== -1) console.log("PASS"); + if (-1 !== a.indexOf("foo")) console.log("PASS"); } expect: { - if (~Object.keys({ foo: 42 }).indexOf("foo")) console.log("PASS"); - } - expect_stdout: "PASS" + var a = Object.keys({ foo: 42 }); + if (!~a.indexOf("bar")) console.log("PASS"); + if (!~a.indexOf("bar")) console.log("PASS"); + if (~a.indexOf("foo")) console.log("PASS"); + if (~a.indexOf("foo")) console.log("PASS"); + if (~a.indexOf("foo")) console.log("PASS"); + if (~a.indexOf("foo")) console.log("PASS"); + if (!~a.indexOf("bar")) console.log("PASS"); + if (!~a.indexOf("bar")) console.log("PASS"); + if (!~a.indexOf("bar")) console.log("PASS"); + if (!~a.indexOf("bar")) console.log("PASS"); + if (~a.indexOf("foo")) console.log("PASS"); + if (~a.indexOf("foo")) console.log("PASS"); + if (~a.indexOf("foo")) console.log("PASS"); + if (~a.indexOf("foo")) console.log("PASS"); + } + expect_stdout: [ + "PASS", + "PASS", + "PASS", + "PASS", + "PASS", + "PASS", + "PASS", + "PASS", + "PASS", + "PASS", + "PASS", + "PASS", + "PASS", + "PASS", + ] } issue_3413: { |