aboutsummaryrefslogtreecommitdiff
path: root/test/mocha/number-literal.js
diff options
context:
space:
mode:
authorAnthony Van de Gejuchte <anthonyvdgent@gmail.com>2016-07-21 03:19:24 +0200
committerAnthony Van de Gejuchte <anthonyvdgent@gmail.com>2016-07-21 14:42:16 +0200
commit642273c29002e7676719f489d7fcf552974118f4 (patch)
tree49b1e07d8e93449544b7f17d368303255572b81f /test/mocha/number-literal.js
parente8b23c779816442a1d4e06453f06ab5a187ac98e (diff)
downloadtracifyjs-642273c29002e7676719f489d7fcf552974118f4.tar.gz
tracifyjs-642273c29002e7676719f489d7fcf552974118f4.zip
Legacy octal integer strict mode fixes
Diffstat (limited to 'test/mocha/number-literal.js')
-rw-r--r--test/mocha/number-literal.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/mocha/number-literal.js b/test/mocha/number-literal.js
new file mode 100644
index 00000000..8e05574a
--- /dev/null
+++ b/test/mocha/number-literal.js
@@ -0,0 +1,24 @@
+var assert = require("assert");
+var uglify = require("../../");
+
+describe("Number literals", function () {
+ it("Should not allow legacy octal literals in strict mode", function() {
+ var inputs = [
+ '"use strict";00;',
+ '"use strict"; var foo = 00;'
+ ];
+
+ var test = function(input) {
+ return function() {
+ uglify.parse(input);
+ }
+ }
+ var error = function(e) {
+ return e instanceof uglify.JS_Parse_Error &&
+ e.message === "SyntaxError: Legacy octal literals are not allowed in strict mode";
+ }
+ for (var i = 0; i < inputs.length; i++) {
+ assert.throws(test(inputs[i]), error, inputs[i]);
+ }
+ });
+}); \ No newline at end of file