aboutsummaryrefslogtreecommitdiff
path: root/test/mocha/comment_before_constant.js
blob: 9b69e078f7ac65b56980a665670c9913259c9683 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var Uglify = require('../../');
var assert = require("assert");

describe("comment before constant", function() {
    var js = 'function f() { /*c1*/ var /*c2*/ foo = /*c3*/ false; return foo; }';

    it("Should test comment before constant is retained and output after mangle.", function() {
        var result = Uglify.minify(js, {
            compress: { collapse_vars: false, reduce_vars: false },
            output: { comments: true },
        });
        assert.strictEqual(result.code, 'function f(){/*c1*/var/*c2*/n=/*c3*/!1;return n}');
    });

    it("Should test code works when comments disabled.", function() {
        var result = Uglify.minify(js, {
            compress: { collapse_vars: false, reduce_vars: false },
            output: { comments: false },
        });
        assert.strictEqual(result.code, 'function f(){var n=!1;return n}');
    });
});