aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/evaluate.js61
-rw-r--r--test/compress/properties.js20
2 files changed, 49 insertions, 32 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js
index da928b3c..e5ecc6d5 100644
--- a/test/compress/evaluate.js
+++ b/test/compress/evaluate.js
@@ -558,34 +558,45 @@ unsafe_array: {
unsafe: true,
}
input: {
- console.log(
- [1, , 3][1],
- [1, 2, 3, a] + 1,
- [1, 2, 3, 4] + 1,
- [1, 2, 3, a][0] + 1,
- [1, 2, 3, 4][0] + 1,
- [1, 2, 3, 4][6 - 5] + 1,
- [1, , 3, 4][6 - 5] + 1,
- [[1, 2], [3, 4]][0] + 1,
- [[1, 2], [3, 4]][6 - 5][1] + 1,
- [[1, 2], , [3, 4]][6 - 5][1] + 1
- );
+ var a = "PASS";
+ Array.prototype[1] = a;
+ console.log([1, , 3][1]);
+ console.log([1, 2, 3, a] + 1);
+ console.log([1, 2, 3, 4] + 1);
+ console.log([1, 2, 3, a][0] + 1);
+ console.log([1, 2, 3, 4][0] + 1);
+ console.log([1, 2, 3, 4][6 - 5] + 1);
+ console.log([1, , 3, 4][6 - 5] + 1);
+ console.log([[1, 2], [3, 4]][0] + 1);
+ console.log([[1, 2], [3, 4]][6 - 5][1] + 1);
+ console.log([[1, 2], , [3, 4]][6 - 5][1] + 1);
}
expect: {
- console.log(
- void 0,
- [1, 2, 3, a] + 1,
- "1,2,3,41",
- [1, 2, 3, a][0] + 1,
- 2,
- 3,
- NaN,
- "1,21",
- 5,
- (void 0)[1] + 1
- );
+ var a = "PASS";
+ Array.prototype[1] = a;
+ console.log([1, , 3][1]);
+ console.log([1, 2, 3, a] + 1);
+ console.log("1,2,3,41");
+ console.log([1, 2, 3, a][0] + 1);
+ console.log(2);
+ console.log(3);
+ console.log([1, , 3, 4][1] + 1);
+ console.log("1,21");
+ console.log(5);
+ console.log([[1, 2], , [3, 4]][1][1] + 1);
}
- expect_stdout: true
+ expect_stdout: [
+ "PASS",
+ "1,2,3,PASS1",
+ "1,2,3,41",
+ "2",
+ "2",
+ "3",
+ "PASS1",
+ "1,21",
+ "5",
+ "A1",
+ ]
}
unsafe_string: {
diff --git a/test/compress/properties.js b/test/compress/properties.js
index 364eb97e..af57c6b9 100644
--- a/test/compress/properties.js
+++ b/test/compress/properties.js
@@ -1046,16 +1046,22 @@ array_hole: {
side_effects: true,
}
input: {
- console.log(
- [ 1, 2, , 3][1],
- [ 1, 2, , 3][2],
- [ 1, 2, , 3][3]
- );
+ Array.prototype[2] = "PASS";
+ console.log([ 1, 2, , 3 ][1]);
+ console.log([ 1, 2, , 3 ][2]);
+ console.log([ 1, 2, , 3 ][3]);
}
expect: {
- console.log(2, void 0, 3);
+ Array.prototype[2] = "PASS";
+ console.log(2);
+ console.log([ , , , ][2]);
+ console.log(3);
}
- expect_stdout: "2 undefined 3"
+ expect_stdout: [
+ "2",
+ "PASS",
+ "3",
+ ]
}
new_this: {