diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-12-06 21:22:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 05:22:40 +0800 |
commit | 2cbbf5c375a0fae88345c3ed3bc2829b4b1ac250 (patch) | |
tree | f1dd106d04820e8002d2f99cba76206d690d7c96 /test/mocha/async.js | |
parent | 3c384cf9a8ed4230cf87f14ab017b613b38df628 (diff) | |
download | tracifyjs-2cbbf5c375a0fae88345c3ed3bc2829b4b1ac250.tar.gz tracifyjs-2cbbf5c375a0fae88345c3ed3bc2829b4b1ac250.zip |
support async function (#4333)
Diffstat (limited to 'test/mocha/async.js')
-rw-r--r-- | test/mocha/async.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/mocha/async.js b/test/mocha/async.js new file mode 100644 index 00000000..dc1aa2f4 --- /dev/null +++ b/test/mocha/async.js @@ -0,0 +1,23 @@ +var assert = require("assert"); +var UglifyJS = require("../node"); + +describe("async", function() { + it("Should reject `await` as symbol name within async functions only", function() { + [ + "function await() {}", + "function(await) {}", + "function() { await; }", + "function() { await:{} }", + "function() { var await; }", + "function() { function await() {} }", + "function() { try {} catch (await) {} }", + ].forEach(function(code) { + UglifyJS.parse("(" + code + ")();"); + assert.throws(function() { + UglifyJS.parse("(async " + code + ")();"); + }, function(e) { + return e instanceof UglifyJS.JS_Parse_Error; + }, code); + }); + }); +}); |