aboutsummaryrefslogtreecommitdiff
path: root/test/compress/issue-1588.js
blob: 40efb63b72a1c1609286e1f374162b4b62aab853 (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
screw_ie8: {
    options = {
        ie8: false,
    }
    mangle = {
        ie8: false,
    }
    input: {
        try { throw "foo"; } catch (x) { console.log(x); }
    }
    expect_exact: 'try{throw"foo"}catch(o){console.log(o)}'
    expect_stdout: [
        "foo"
    ]
}

support_ie8: {
    options = {
        ie8: true,
    }
    mangle = {
        ie8: true,
    }
    input: {
        try { throw "foo"; } catch (x) { console.log(x); }
    }
    expect_exact: 'try{throw"foo"}catch(x){console.log(x)}'
    expect_stdout: "foo"
}

safe_undefined: {
    options = {
        conditionals: true,
        if_return: true,
        unsafe: false,
    }
    mangle = {}
    input: {
        var a, c;
        console.log(function(undefined) {
            return function() {
                if (a)
                    return b;
                if (c)
                    return d;
            };
        }(1)());
    }
    expect: {
        var a, c;
        console.log(function(n) {
            return function() {
                return a ? b : c ? d : void 0;
            };
        }(1)());
    }
    expect_stdout: true
}

unsafe_undefined: {
    options = {
        conditionals: true,
        if_return: true,
        unsafe_undefined: true,
    }
    mangle = {}
    input: {
        var a, c;
        console.log(function(undefined) {
            return function() {
                if (a)
                    return b;
                if (c)
                    return d;
            };
        }()());
    }
    expect: {
        var a, c;
        console.log(function(n) {
            return function() {
                return a ? b : c ? d : n;
            };
        }()());
    }
    expect_stdout: true
}