From f8caab3378066537e9a12cb5a23bbf29375f6fb3 Mon Sep 17 00:00:00 2001 From: dudemelo Date: Mon, 25 Jul 2016 15:14:04 -0300 Subject: [PATCH] Add test to preserve a single space before the unary operator. --- test/mocha/minify.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/mocha/minify.js b/test/mocha/minify.js index 02d31558..66cde605 100644 --- a/test/mocha/minify.js +++ b/test/mocha/minify.js @@ -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;'); + }); }); + });