diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2017-07-29 23:02:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-29 23:02:04 +0800 |
commit | a845897758aa2cbccf71f37643d31b08cdd22a0e (patch) | |
tree | a845d73050ec30bbc089252df13a2258053c5e65 /test/run-tests.js | |
parent | 32ea2c5530079ddbbbc50b23b2adeff44ba7b5df (diff) | |
download | tracifyjs-a845897758aa2cbccf71f37643d31b08cdd22a0e.tar.gz tracifyjs-a845897758aa2cbccf71f37643d31b08cdd22a0e.zip |
improve `mangle.properties` (#2261)
- include dead code when `keep_quoted`
- unify `keep_quoted` & `reserved`
- make `test/run-tests.js` consistent with `minify()`
fixes #2256
Diffstat (limited to 'test/run-tests.js')
-rwxr-xr-x | test/run-tests.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/test/run-tests.js b/test/run-tests.js index 6b8c9ddf..0051c6c2 100755 --- a/test/run-tests.js +++ b/test/run-tests.js @@ -111,18 +111,22 @@ function run_compress_tests() { }; if (!options.warnings) options.warnings = true; } + if (test.mangle && test.mangle.properties && test.mangle.properties.keep_quoted) { + var quoted_props = test.mangle.properties.reserved; + if (!Array.isArray(quoted_props)) quoted_props = []; + test.mangle.properties.reserved = quoted_props; + U.reserve_quoted_keys(input, quoted_props); + } var cmp = new U.Compressor(options, true); var output = cmp.compress(input); output.figure_out_scope(test.mangle); - if (test.mangle || test.mangle_props) { + if (test.mangle) { U.base54.reset(); output.compute_char_frequency(test.mangle); - } - if (test.mangle) { output.mangle_names(test.mangle); - } - if (test.mangle_props) { - output = U.mangle_properties(output, test.mangle_props); + if (test.mangle.properties) { + output = U.mangle_properties(output, test.mangle.properties); + } } output = make_code(output, output_options); if (expect != output) { |