aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAnthony Van de Gejuchte <anthonyvdgent@gmail.com>2016-10-26 12:34:38 +0200
committerAnthony Van de Gejuchte <anthonyvdgent@gmail.com>2016-10-27 22:55:49 +0200
commit057de570e69b300ca472719cb234a32e593d34ec (patch)
tree3c74531099cdf87e464a639533b1549b57b0ccb2 /test/compress
parent557b3e412fb44906e0a41dc2c209e5712bd67974 (diff)
downloadtracifyjs-057de570e69b300ca472719cb234a32e593d34ec.tar.gz
tracifyjs-057de570e69b300ca472719cb234a32e593d34ec.zip
Pass mangle options to figure_out_scope before mangling in tests
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/screw-ie8.js114
1 files changed, 113 insertions, 1 deletions
diff --git a/test/compress/screw-ie8.js b/test/compress/screw-ie8.js
index 527aea04..0a4e2323 100644
--- a/test/compress/screw-ie8.js
+++ b/test/compress/screw-ie8.js
@@ -15,4 +15,116 @@ dont_screw: {
input: f("\v");
expect_exact: 'f("\\x0B");';
-} \ No newline at end of file
+}
+
+do_screw_try_catch: {
+ options = { screw_ie8: true };
+ mangle = { screw_ie8: true };
+ beautify = { screw_ie8: true };
+ input: {
+ good = function(e){
+ return function(error){
+ try{
+ e()
+ } catch(e) {
+ error(e)
+ }
+ }
+ };
+ }
+ expect: {
+ good = function(n){
+ return function(t){
+ try{
+ n()
+ } catch(n) {
+ t(n)
+ }
+ }
+ };
+ }
+}
+
+dont_screw_try_catch: {
+ options = { screw_ie8: false };
+ mangle = { screw_ie8: false };
+ beautify = { screw_ie8: false };
+ input: {
+ bad = function(e){
+ return function(error){
+ try{
+ e()
+ } catch(e) {
+ error(e)
+ }
+ }
+ };
+ }
+ expect: {
+ bad = function(n){
+ return function(n){
+ try{
+ t()
+ } catch(t) {
+ n(t)
+ }
+ }
+ };
+ }
+}
+
+do_screw_try_catch_undefined: {
+ options = { screw_ie8: true };
+ mangle = { screw_ie8: true };
+ beautify = { screw_ie8: true };
+ input: {
+ function a(b){
+ try {
+ throw 'Stuff';
+ } catch (undefined) {
+ console.log('caught: ' + undefined);
+ }
+ console.log('undefined is ' + undefined);
+ return b === undefined;
+ };
+ }
+ expect: {
+ function a(o){
+ try{
+ throw "Stuff"
+ } catch (o) {
+ console.log("caught: "+o)
+ }
+ console.log("undefined is " + void 0);
+ return void 0===o
+ }
+ }
+}
+
+dont_screw_try_catch_undefined: {
+ options = { screw_ie8: false };
+ mangle = { screw_ie8: false };
+ beautify = { screw_ie8: false };
+ input: {
+ function a(b){
+ try {
+ throw 'Stuff';
+ } catch (undefined) {
+ console.log('caught: ' + undefined);
+ }
+ console.log('undefined is ' + undefined);
+ return b === undefined;
+ };
+ }
+ expect: {
+ function a(o){
+ try{
+ throw "Stuff"
+ } catch (n) {
+ console.log("caught: "+n)
+ }
+ console.log("undefined is " + void 0);
+ return void 0===o
+ }
+ }
+}