Add test to preserve a single space before the unary operator.

This commit is contained in:
dudemelo 2016-07-25 15:14:04 -03:00
parent e8b23c7798
commit f8caab3378

View File

@ -58,5 +58,14 @@ describe("minify", function() {
assert.strictEqual(result.code,
'a["foo"]="bar",a.a="red",x={"bar":10};');
});
});
describe('Unary operators', function () {
it('Should preserve a space before increment/decrement', function () {
var js = 'var a = 1 + ++1;var b = 2 - ++1;';
var result = Uglify.minify(js, { fromString: true });
assert.strictEqual(result.code, 'var a=1+ ++1,b=2- ++1;');
});
});
});