diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-06-07 22:23:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-08 05:23:23 +0800 |
commit | df3bb8028a7cd8a69a3c76090d12f808ca7abc3b (patch) | |
tree | 210770477d209324562885e6777d3d150ce27035 /test/mocha/operator.js | |
parent | 28b7b15da19a2a081ab768f8315ce39db7c52b63 (diff) | |
download | tracifyjs-df3bb8028a7cd8a69a3c76090d12f808ca7abc3b.tar.gz tracifyjs-df3bb8028a7cd8a69a3c76090d12f808ca7abc3b.zip |
fix corner cases related to `in` (#3964)
Diffstat (limited to 'test/mocha/operator.js')
-rw-r--r-- | test/mocha/operator.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/mocha/operator.js b/test/mocha/operator.js index d36d3a1d..8dfea547 100644 --- a/test/mocha/operator.js +++ b/test/mocha/operator.js @@ -486,4 +486,19 @@ describe("operator", function() { assert.strictEqual(UglifyJS.parse(exp[0]).print_to_string(), exp[1] + ";"); }); }); + it("Should preserve space between /regex/ and `in`", function() { + [ + "/regex/ in {}", + "/regex/g in {}", + "0 + /regex/ in {}", + "0 + /regex/g in {}", + ].forEach(function(exp) { + var code = UglifyJS.parse(exp).print_to_string(); + try { + assert.strictEqual(UglifyJS.parse(code).print_to_string(), code); + } catch (ex) { + assert.fail("Failed to reparse: " + exp + "\n" + ex); + } + }); + }); }); |