aboutsummaryrefslogtreecommitdiff
path: root/test/compress/properties.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/compress/properties.js')
-rw-r--r--test/compress/properties.js51
1 files changed, 50 insertions, 1 deletions
diff --git a/test/compress/properties.js b/test/compress/properties.js
index 22f2c339..7ad54ebe 100644
--- a/test/compress/properties.js
+++ b/test/compress/properties.js
@@ -54,7 +54,56 @@ dot_properties_es5: {
}
}
-evaluate_length: {
+sub_properties: {
+ options = {
+ evaluate: true,
+ properties: true
+ };
+ input: {
+ a[0] = 0;
+ a["0"] = 1;
+ a[3.14] = 2;
+ a["3" + ".14"] = 3;
+ a["i" + "f"] = 4;
+ a["foo" + " bar"] = 5;
+ a[0 / 0] = 6;
+ a[null] = 7;
+ a[undefined] = 8;
+ }
+ expect: {
+ a[0] = 0;
+ a[0] = 1;
+ a[3.14] = 2;
+ a[3.14] = 3;
+ a.if = 4;
+ a["foo bar"] = 5;
+ a[NaN] = 6;
+ a[null] = 7;
+ a[void 0] = 8;
+ }
+}
+
+evaluate_array_length: {
+ options = {
+ properties: true,
+ unsafe: true,
+ evaluate: true
+ };
+ input: {
+ a = [1, 2, 3].length;
+ a = [1, 2, 3].join()["len" + "gth"];
+ a = [1, 2, b].length;
+ a = [1, 2, 3].join(b).length;
+ }
+ expect: {
+ a = 3;
+ a = 5;
+ a = [1, 2, b].length;
+ a = [1, 2, 3].join(b).length;
+ }
+}
+
+evaluate_string_length: {
options = {
properties: true,
unsafe: true,