aboutsummaryrefslogtreecommitdiff
path: root/test/compress/screw-ie8.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-03-05 12:51:11 +0800
committerGitHub <noreply@github.com>2017-03-05 12:51:11 +0800
commit1f0333e9f146311e0e412fbd0783c0e1e63c7802 (patch)
tree8ad032bf7c16c7c89086331499a1c066407a2374 /test/compress/screw-ie8.js
parenteb98a7f2f38f5de16b50560199ee7ec719a1e945 (diff)
downloadtracifyjs-1f0333e9f146311e0e412fbd0783c0e1e63c7802.tar.gz
tracifyjs-1f0333e9f146311e0e412fbd0783c0e1e63c7802.zip
stay safe with constants in IE8- (#1547)
- `undefined` etc. can be redefined at top-level for IE8-, so disable related optimisations - fixed `--support-ie8` catch mangle bug
Diffstat (limited to 'test/compress/screw-ie8.js')
-rw-r--r--test/compress/screw-ie8.js42
1 files changed, 29 insertions, 13 deletions
diff --git a/test/compress/screw-ie8.js b/test/compress/screw-ie8.js
index 31c448fd..51379b15 100644
--- a/test/compress/screw-ie8.js
+++ b/test/compress/screw-ie8.js
@@ -17,6 +17,26 @@ dont_screw: {
expect_exact: 'f("\\x0B");';
}
+do_screw_constants: {
+ options = {
+ screw_ie8: true,
+ }
+ input: {
+ f(undefined, Infinity);
+ }
+ expect_exact: "f(void 0,1/0);"
+}
+
+dont_screw_constants: {
+ options = {
+ screw_ie8: false,
+ }
+ input: {
+ f(undefined, Infinity);
+ }
+ expect_exact: "f(undefined,Infinity);"
+}
+
do_screw_try_catch: {
options = { screw_ie8: true };
mangle = { screw_ie8: true };
@@ -46,8 +66,6 @@ do_screw_try_catch: {
}
dont_screw_try_catch: {
- // This test is known to generate incorrect code for screw_ie8=false.
- // Update expected result in the event this bug is ever fixed.
options = { screw_ie8: false };
mangle = { screw_ie8: false };
beautify = { screw_ie8: false };
@@ -64,11 +82,11 @@ dont_screw_try_catch: {
}
expect: {
bad = function(n){
- return function(n){
+ return function(t){
try{
- t()
- } catch(t) {
- n(t)
+ n()
+ } catch(n) {
+ t(n)
}
}
};
@@ -104,8 +122,6 @@ do_screw_try_catch_undefined: {
}
dont_screw_try_catch_undefined: {
- // This test is known to generate incorrect code for screw_ie8=false.
- // Update expected result in the event this bug is ever fixed.
options = { screw_ie8: false };
mangle = { screw_ie8: false };
beautify = { screw_ie8: false };
@@ -121,14 +137,14 @@ dont_screw_try_catch_undefined: {
};
}
expect: {
- function a(o){
+ function a(n){
try{
throw "Stuff"
- } catch (n) {
- console.log("caught: "+n)
+ } catch (undefined) {
+ console.log("caught: " + undefined)
}
- console.log("undefined is " + n);
- return o === n
+ console.log("undefined is " + undefined);
+ return n === undefined
}
}
}