aboutsummaryrefslogtreecommitdiff
path: root/test/compress/evaluate.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-06-13 19:50:26 +0100
committerGitHub <noreply@github.com>2020-06-14 02:50:26 +0800
commit88850a6e05b25a4ffa66e729cca56bd15850a756 (patch)
treef8d384746596fc71176be5b958604b3a3be24677 /test/compress/evaluate.js
parent9e881407bda32aeca1d383aa4137553c88419354 (diff)
downloadtracifyjs-88850a6e05b25a4ffa66e729cca56bd15850a756.tar.gz
tracifyjs-88850a6e05b25a4ffa66e729cca56bd15850a756.zip
enhance `evaluate` (#3995)
Diffstat (limited to 'test/compress/evaluate.js')
-rw-r--r--test/compress/evaluate.js42
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",
+ ]
+}