aboutsummaryrefslogtreecommitdiff
path: root/test/compress/webkit.js
blob: f67a7b7f498f60f293cc6d3f9abcb6a3ebc8d7b2 (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
lambda_call_dot_assign: {
    beautify = {
        webkit: false,
    }
    input: {
        console.log(function() {
            return {};
        }().a = 1);
    }
    expect_exact: "console.log(function(){return{}}().a=1);"
    expect_stdout: "1"
}

lambda_call_dot_assign_webkit: {
    beautify = {
        webkit: true,
    }
    input: {
        console.log(function() {
            return {};
        }().a = 1);
    }
    expect_exact: "console.log((function(){return{}}()).a=1);"
    expect_stdout: "1"
}

lambda_dot_assign: {
    beautify = {
        webkit: false,
    }
    input: {
        console.log(function() {
            1 + 1;
        }.a = 1);
    }
    expect_exact: "console.log(function(){1+1}.a=1);"
    expect_stdout: "1"
}

lambda_dot_assign_webkit: {
    beautify = {
        webkit: true,
    }
    input: {
        console.log(function() {
            1 + 1;
        }.a = 1);
    }
    expect_exact: "console.log((function(){1+1}).a=1);"
    expect_stdout: "1"
}

lambda_name_mangle: {
    mangle = {}
    input: {
        console.log(typeof function foo(bar) {});
    }
    expect_exact: "console.log(typeof function o(n){});"
    expect_stdout: "function"
}

lambda_name_mangle_ie8: {
    mangle = {
        ie8: true,
        toplevel: true,
    }
    input: {
        console.log(typeof function foo(bar) {});
    }
    expect_exact: "console.log(typeof function n(o){});"
    expect_stdout: "function"
}

function_name_mangle: {
    options = {
        keep_fnames: true,
        reduce_vars: true,
        unused: true,
    }
    mangle = {}
    input: {
        (function() {
            function foo(bar) {}
            console.log(typeof foo);
        })();
    }
    expect_exact: "(function(){console.log(typeof function o(n){})})();"
    expect_stdout: "function"
}

function_name_mangle_ie8: {
    options = {
        keep_fnames: true,
        reduce_vars: true,
        unused: true,
    }
    mangle = {
        ie8: true,
        toplevel: true,
    }
    input: {
        (function() {
            function foo(bar) {}
            console.log(typeof foo);
        })();
    }
    expect_exact: "(function(){console.log(typeof function n(o){})})();"
    expect_stdout: "function"
}