diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-06-13 19:50:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-14 02:50:26 +0800 |
commit | 88850a6e05b25a4ffa66e729cca56bd15850a756 (patch) | |
tree | f8d384746596fc71176be5b958604b3a3be24677 /test/compress/evaluate.js | |
parent | 9e881407bda32aeca1d383aa4137553c88419354 (diff) | |
download | tracifyjs-88850a6e05b25a4ffa66e729cca56bd15850a756.tar.gz tracifyjs-88850a6e05b25a4ffa66e729cca56bd15850a756.zip |
enhance `evaluate` (#3995)
Diffstat (limited to 'test/compress/evaluate.js')
-rw-r--r-- | test/compress/evaluate.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js index e5ecc6d5..4fecd701 100644 --- a/test/compress/evaluate.js +++ b/test/compress/evaluate.js @@ -560,6 +560,8 @@ unsafe_array: { input: { var a = "PASS"; Array.prototype[1] = a; + console.log([, ].length); + console.log("" + [, , ]); console.log([1, , 3][1]); console.log([1, 2, 3, a] + 1); console.log([1, 2, 3, 4] + 1); @@ -574,6 +576,8 @@ unsafe_array: { expect: { var a = "PASS"; Array.prototype[1] = a; + console.log([, ].length); + console.log("" + [, , ]); console.log([1, , 3][1]); console.log([1, 2, 3, a] + 1); console.log("1,2,3,41"); @@ -586,6 +590,8 @@ unsafe_array: { console.log([[1, 2], , [3, 4]][1][1] + 1); } expect_stdout: [ + "1", + ",PASS", "PASS", "1,2,3,PASS1", "1,2,3,41", @@ -2770,3 +2776,39 @@ issue_3988: { } expect_stdout: "0" } + +operator_in: { + options = { + evaluate: true, + unsafe: true, + } + input: { + Object.prototype.PASS = 0; + console.log(0 in [ 1 ]); + console.log(0 in [ , ]); + console.log(0 / 0 in { NaN: 2 }); + console.log("PASS" in { }); + console.log("FAIL" in { }); + console.log("toString" in { }); + console.log("toString" in { toString: 3 }); + } + expect: { + Object.prototype.PASS = 0; + console.log(true); + console.log(0 in [ , ]); + console.log(true); + console.log("PASS" in { }); + console.log("FAIL" in { }); + console.log("toString" in { }); + console.log(true); + } + expect_stdout: [ + "true", + "false", + "true", + "true", + "false", + "true", + "true", + ] +} |