diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2019-11-29 18:57:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-29 18:57:29 +0800 |
commit | 1283d738539b4f899e4941f556b516c071bfa55a (patch) | |
tree | e563bbcfbe2932579f2f1778a0946ac3df945445 /test/mocha | |
parent | 1b61a81b5d6c9489466fe4707c1b01810a01d03a (diff) | |
download | tracifyjs-1283d738539b4f899e4941f556b516c071bfa55a.tar.gz tracifyjs-1283d738539b4f899e4941f556b516c071bfa55a.zip |
fix corner case in parsing directives (#3615)
Diffstat (limited to 'test/mocha')
-rw-r--r-- | test/mocha/directives.js | 12 | ||||
-rw-r--r-- | test/mocha/number-literal.js | 10 |
2 files changed, 15 insertions, 7 deletions
diff --git a/test/mocha/directives.js b/test/mocha/directives.js index 74660dc6..e872747a 100644 --- a/test/mocha/directives.js +++ b/test/mocha/directives.js @@ -54,8 +54,8 @@ describe("Directives", function() { [ [ '"use strict"\n', - [ "use strict"], - [ "use asm"] + [ "use strict" ], + [ "use asm" ] ], [ '"use\\\nstrict";', @@ -80,8 +80,8 @@ describe("Directives", function() { [ // no ; or newline '"use strict"', - [], - [ "use strict", "use\nstrict", "use \nstrict", "use asm" ] + [ "use strict" ], + [ "use\nstrict", "use \nstrict", "use asm" ] ], [ ';"use strict"', @@ -116,8 +116,8 @@ describe("Directives", function() { ], [ 'var foo = function() {"use strict"', // no ; or newline - [], - [ "use strict", "use\nstrict", "use \nstrict", "use asm" ] + [ "use strict" ], + [ "use\nstrict", "use \nstrict", "use asm" ] ], [ 'var foo = function() {;"use strict"', diff --git a/test/mocha/number-literal.js b/test/mocha/number-literal.js index c7560eb5..b87c88bb 100644 --- a/test/mocha/number-literal.js +++ b/test/mocha/number-literal.js @@ -2,10 +2,18 @@ var assert = require("assert"); var UglifyJS = require("../node"); describe("Number literals", function() { + it("Should allow legacy octal literals in non-strict mode", function() { + [ + "'use strict'\n.slice()\n00", + '"use strict"\n.slice()\nvar foo = 00', + ].forEach(function(input) { + UglifyJS.parse(input); + }); + }); it("Should not allow legacy octal literals in strict mode", function() { var inputs = [ '"use strict";00;', - '"use strict"; var foo = 00;' + '"use strict"; var foo = 00;', ]; var test = function(input) { return function() { |