aboutsummaryrefslogtreecommitdiff
path: root/test/compress/screw-ie8.js
blob: 51379b159c281b71f93c7eef380bd97673b82fe6 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
do_screw: {
    options = { screw_ie8: true };
    beautify = {
        screw_ie8: true,
        ascii_only: true
    };

    input: f("\v");
    expect_exact: 'f("\\v");';
}

dont_screw: {
    options = { screw_ie8: false };
    beautify = { screw_ie8: false, ascii_only: true };

    input: f("\v");
    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 };
    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(t){
                try{
                    n()
                } catch(n) {
                    t(n)
                }
            }
        };
    }
}

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(n){
            try{
                throw "Stuff"
            } catch (undefined) {
                console.log("caught: " + undefined)
            }
            console.log("undefined is " + undefined);
            return n === undefined
        }
    }
}