diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2018-05-19 05:45:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-19 05:45:14 +0800 |
commit | 4fc39d8dadcec807be9d80ceb1d585f41b20c961 (patch) | |
tree | aa798fa8d4438e3265502dcc4a92f434f7c5cdc2 /test/compress | |
parent | 0b7c70f7260fc48023aa6e1685f35547b1cca6f2 (diff) | |
download | tracifyjs-4fc39d8dadcec807be9d80ceb1d585f41b20c961.tar.gz tracifyjs-4fc39d8dadcec807be9d80ceb1d585f41b20c961.zip |
fix corner case in `collapse_vars` (#3139)
Diffstat (limited to 'test/compress')
-rw-r--r-- | test/compress/collapse_vars.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js index c915041f..bcc8b833 100644 --- a/test/compress/collapse_vars.js +++ b/test/compress/collapse_vars.js @@ -4931,6 +4931,27 @@ collapse_rhs_lhs_2: { expect_stdout: "PASS" } +collapse_rhs_loop: { + options = { + collapse_vars: true, + } + input: { + var s; + s = "<tpl>PASS</tpl>"; + for (var m, r = /<tpl>(.*)<\/tpl>/; m = s.match(r);) + s = s.replace(m[0], m[1]); + console.log(s); + } + expect: { + var s; + s = "<tpl>PASS</tpl>"; + for (var m, r = /<tpl>(.*)<\/tpl>/; m = s.match(r);) + s = s.replace(m[0], m[1]); + console.log(s); + } + expect_stdout: "PASS" +} + collapse_rhs_side_effects: { options = { collapse_vars: true, |