aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkzc <zaxxon2011@gmail.com>2016-12-21 10:52:30 -0500
committerRichard van Velzen <rvanvelzen1@gmail.com>2017-01-19 17:14:33 +0100
commitec2e5fa3a2e5cf421aebd94b93c668b18e540c69 (patch)
treea53aa39e78162035803619f0d03800384e9376f4 /test
parentda17766ddda3b89f94706ad7e329faa66a3e3a3e (diff)
downloadtracifyjs-ec2e5fa3a2e5cf421aebd94b93c668b18e540c69.tar.gz
tracifyjs-ec2e5fa3a2e5cf421aebd94b93c668b18e540c69.zip
Have minify() and tests use figure_out_scope() as uglifyjs CLI does
Clarify docs, help and tests for --support-ie8 and screw_ie8=false
Diffstat (limited to 'test')
-rw-r--r--test/compress/screw-ie8.js8
-rwxr-xr-xtest/run-tests.js8
2 files changed, 10 insertions, 6 deletions
diff --git a/test/compress/screw-ie8.js b/test/compress/screw-ie8.js
index 0a4e2323..31c448fd 100644
--- a/test/compress/screw-ie8.js
+++ b/test/compress/screw-ie8.js
@@ -46,6 +46,8 @@ do_screw_try_catch: {
}
dont_screw_try_catch: {
+ // This test is known to generate incorrect code for screw_ie8=false.
+ // Update expected result in the event this bug is ever fixed.
options = { screw_ie8: false };
mangle = { screw_ie8: false };
beautify = { screw_ie8: false };
@@ -102,6 +104,8 @@ do_screw_try_catch_undefined: {
}
dont_screw_try_catch_undefined: {
+ // This test is known to generate incorrect code for screw_ie8=false.
+ // Update expected result in the event this bug is ever fixed.
options = { screw_ie8: false };
mangle = { screw_ie8: false };
beautify = { screw_ie8: false };
@@ -123,8 +127,8 @@ dont_screw_try_catch_undefined: {
} catch (n) {
console.log("caught: "+n)
}
- console.log("undefined is " + void 0);
- return void 0===o
+ console.log("undefined is " + n);
+ return o === n
}
}
}
diff --git a/test/run-tests.js b/test/run-tests.js
index 8fb93c83..a4721399 100755
--- a/test/run-tests.js
+++ b/test/run-tests.js
@@ -70,12 +70,12 @@ function test_directory(dir) {
return path.resolve(tests_dir, dir);
}
-function as_toplevel(input) {
+function as_toplevel(input, mangle_options) {
if (input instanceof U.AST_BlockStatement) input = input.body;
else if (input instanceof U.AST_Statement) input = [ input ];
else throw new Error("Unsupported input syntax");
var toplevel = new U.AST_Toplevel({ body: input });
- toplevel.figure_out_scope();
+ toplevel.figure_out_scope(mangle_options);
return toplevel;
}
@@ -103,11 +103,11 @@ function run_compress_tests() {
var output_options = test.beautify || {};
var expect;
if (test.expect) {
- expect = make_code(as_toplevel(test.expect), output_options);
+ expect = make_code(as_toplevel(test.expect, test.mangle), output_options);
} else {
expect = test.expect_exact;
}
- var input = as_toplevel(test.input);
+ var input = as_toplevel(test.input, test.mangle);
var input_code = make_code(test.input, {
beautify: true,
quote_style: 3,