diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/if_return.js | 22 | ||||
-rw-r--r-- | test/mocha/cli.js | 4 | ||||
-rw-r--r-- | test/mocha/spidermonkey.js | 4 |
3 files changed, 28 insertions, 2 deletions
diff --git a/test/compress/if_return.js b/test/compress/if_return.js index 0ac45c3c..c09d67b6 100644 --- a/test/compress/if_return.js +++ b/test/compress/if_return.js @@ -302,3 +302,25 @@ issue_1437_conditionals: { } } } + +issue_512: { + options = { + conditionals: true, + if_return: true, + } + input: { + function a() { + if (b()) { + c(); + return; + } + throw e; + } + } + expect: { + function a() { + if (!b()) throw e; + c(); + } + } +} diff --git a/test/mocha/cli.js b/test/mocha/cli.js index 335b224d..db4a2c33 100644 --- a/test/mocha/cli.js +++ b/test/mocha/cli.js @@ -19,7 +19,9 @@ describe("bin/uglifyjs", function () { eval(stdout); assert.strictEqual(typeof WrappedUglifyJS, 'object'); - assert.strictEqual(WrappedUglifyJS.minify("foo([true,,2+3]);").code, "foo([!0,,5]);"); + var result = WrappedUglifyJS.minify("foo([true,,2+3]);"); + assert.strictEqual(result.error, undefined); + assert.strictEqual(result.code, "foo([!0,,5]);"); done(); }); diff --git a/test/mocha/spidermonkey.js b/test/mocha/spidermonkey.js index a8a112d0..9bddb537 100644 --- a/test/mocha/spidermonkey.js +++ b/test/mocha/spidermonkey.js @@ -15,7 +15,9 @@ describe("spidermonkey export/import sanity test", function() { eval(stdout); assert.strictEqual(typeof SpiderUglify, "object"); - assert.strictEqual(SpiderUglify.minify("foo([true,,2+3]);").code, "foo([!0,,5]);"); + var result = SpiderUglify.minify("foo([true,,2+3]);"); + assert.strictEqual(result.error, undefined); + assert.strictEqual(result.code, "foo([!0,,5]);"); done(); }); |