aboutsummaryrefslogtreecommitdiff
path: root/test/compress/functions.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-05-31 03:38:00 +0800
committerGitHub <noreply@github.com>2017-05-31 03:38:00 +0800
commite9645e017f297e06506cc139922ff012fb763139 (patch)
tree0e2510c7a6aae20844829a6510ca6a2c6d95930d /test/compress/functions.js
parent55b5f2a8aa90a69e523c0a53ca92fcef45e5b209 (diff)
downloadtracifyjs-e9645e017f297e06506cc139922ff012fb763139.tar.gz
tracifyjs-e9645e017f297e06506cc139922ff012fb763139.zip
introduce `unsafe_Func` (#2033)
Separate flag for #203 functionality.
Diffstat (limited to 'test/compress/functions.js')
-rw-r--r--test/compress/functions.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/compress/functions.js b/test/compress/functions.js
index 5ebd9d19..6a9f2aed 100644
--- a/test/compress/functions.js
+++ b/test/compress/functions.js
@@ -245,3 +245,25 @@ hoist_funs_strict: {
]
node_version: ">=4"
}
+
+issue_203: {
+ options = {
+ keep_fargs: false,
+ side_effects: true,
+ unsafe_Func: true,
+ unused: true,
+ }
+ input: {
+ var m = {};
+ var fn = Function("require", "module", "exports", "module.exports = 42;");
+ fn(null, m, m.exports);
+ console.log(m.exports);
+ }
+ expect: {
+ var m = {};
+ var fn = Function("a", "b", "b.exports=42");
+ fn(null, m, m.exports);
+ console.log(m.exports);
+ }
+ expect_stdout: "42"
+}