aboutsummaryrefslogtreecommitdiff
path: root/test/compress/issue-1275.js
blob: 2553c74f37b7b38b1c2bcea8a9331d9c8bcc461e (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 = {
        side_effects  : true,
        evaluate      : true,
        conditionals  : true,
        comparisons   : true,
        dead_code     : true,
        booleans      : true,
        unused        : true,
        if_return     : true,
        join_vars     : true,
        hoist_funs    : 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
}