aboutsummaryrefslogtreecommitdiff
path: root/test/compress/issue-1275.js
blob: 683e336ddf6e9b8388ee69519bfbe2adceb5b626 (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
string_plus_optimization: {
    options = {
        booleans: true,
        comparisons: true,
        conditionals: true,
        dead_code: true,
        evaluate: true,
        hoist_funs: true,
        if_return: true,
        join_vars: true,
        side_effects: true,
        unused: true,
    }
    input: {
        function foo(anything) {
            function throwing_function() {
                throw "nope";
            }
            try {
                console.log('0' + throwing_function() ? "yes" : "no");
            } catch (ex) {
                console.log(ex);
            }
            console.log('0' + anything ? "yes" : "no");
            console.log(anything + '0' ? "Yes" : "No");
            console.log('' + anything);
            console.log(anything + '');
        }
        foo();
    }
    expect: {
        function foo(anything) {
            function throwing_function() {
                throw "nope";
            }
            try {
                console.log((throwing_function(), "yes"));
            } catch (ex) {
                console.log(ex);
            }
            console.log("yes");
            console.log("Yes");
            console.log('' + anything);
            console.log(anything + '');
        }
        foo();
    }
    expect_stdout: true
}