aboutsummaryrefslogtreecommitdiff
path: root/test/compress/issue-1321.js
AgeCommit message (Expand)Author
2017-07-29improve `mangle.properties` (#2261)...Alex Lam S.L
2017-06-23synchronise `mangle.properties` for `minify()` & `test/compress` (#2151)Alex Lam S.L
2017-04-15unify CLI & API under `minify()` (#1811)...Alex Lam S.L
2017-03-19make `expect_stdout` work on Node.js 0.12 (#1623)...Alex Lam S.L
2016-11-29Add --mangle-props-debug and fix --mangle-props=unquoted collision...Ashley (Scirra)
n60' href='#n60'>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
parentheses: {
    input: {
        (console.log("foo") || console.log("bar") ?? console.log("baz")) && console.log("moo");
    }
    expect_exact:'((console.log("foo")||console.log("bar"))??console.log("baz"))&&console.log("moo");'
    expect_stdout: [
        "foo",
        "bar",
        "baz",
    ]
    node_version: ">=14"
}

evaluate: {
    options = {
        evaluate: true,
        side_effects: true,
    }
    input: {
        void console.log("foo" ?? "bar") ?? console.log("baz");
    }
    expect: {
        console.log("foo"),
        console.log("baz");
    }
    expect_stdout: [
        "foo",
        "baz",
    ]
    node_version: ">=14"
}

conditional_assignment_1: {
    options = {
        collapse_vars: true,
    }
    input: {
        console.log(function(a, b) {
            b ?? (a = "FAIL");
            return a;
        }("PASS", !console));
    }
    expect: {
        console.log(function(a, b) {
            b ?? (a = "FAIL");
            return a;
        }("PASS", !console));
    }
    expect_stdout: "PASS"
    node_version: ">=14"
}

conditional_assignment_2: {
    options = {
        conditionals: true,
    }
    input: {
        var a, b = false;
        a = "PASS",
        b ?? (a = "FAIL"),
        console.log(a);
    }
    expect: {
        var a, b = false;
        a = "PASS",
        b ?? (a = "FAIL"),
        console.log(a);
    }
    expect_stdout: "PASS"
    node_version: ">=14"
}

conditional_assignment_3: {
    options = {
        conditionals: true,
        join_vars: true,
    }
    input: {
        var a, b = false;
        a = "PASS",
        b ?? (a = "FAIL"),
        console.log(a);
    }
    expect: {
        var a, b = false, a = "PASS";
        b ?? (a = "FAIL"),
        console.log(a);
    }
    expect_stdout: "PASS"
    node_version: ">=14"
}

conditional_assignment_4: {
    options = {
        side_effects: true,
    }
    input: {
        console.log(function(a) {
            !console ?? (a = "FAIL");
            return a;
        }("PASS"));
    }
    expect: {
        console.log(function(a) {
            !console ?? (a = "FAIL");
            return a;
        }("PASS"));
    }
    expect_stdout: "PASS"
    node_version: ">=14"
}

issue_4679: {
    options = {
        comparisons: true,
        ie8: true,
    }
    input: {
        var a;
        if (void 0 === (undefined ?? a))
            console.log("PASS");
    }
    expect: {
        var a;
        if (void 0 === (undefined ?? a))
            console.log("PASS");
    }
    expect_stdout: "PASS"
    node_version: ">=14"
}