aboutsummaryrefslogtreecommitdiff
path: root/test/compress/evaluate.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-02-17 21:33:36 +0800
committerGitHub <noreply@github.com>2018-02-17 21:33:36 +0800
commit82d1ef02422ac378a524f916d0a29b9ce35743b4 (patch)
tree5a92e9832524688a619397457917aa03d3fec90e /test/compress/evaluate.js
parent7fdd2082a65fd11d3d99c5e62241264ae6e82afc (diff)
downloadtracifyjs-82d1ef02422ac378a524f916d0a29b9ce35743b4.tar.gz
tracifyjs-82d1ef02422ac378a524f916d0a29b9ce35743b4.zip
fix `unsafe` `evaluate` of `function` property (#2927)
fixes #2926
Diffstat (limited to 'test/compress/evaluate.js')
-rw-r--r--test/compress/evaluate.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js
index 2294ca01..614020ea 100644
--- a/test/compress/evaluate.js
+++ b/test/compress/evaluate.js
@@ -1502,3 +1502,36 @@ issue_2919: {
console.log("function(){}");
}
}
+
+issue_2926_1: {
+ options = {
+ evaluate: true,
+ reduce_vars: true,
+ unsafe: true,
+ }
+ input: {
+ (function f(a) {
+ console.log(f.name.length, f.length);
+ })();
+ }
+ expect: {
+ (function f(a) {
+ console.log(1, 1);
+ })();
+ }
+ expect_stdout: "1 1"
+}
+
+issue_2926_2: {
+ options = {
+ evaluate: true,
+ unsafe: true,
+ }
+ input: {
+ console.log(typeof function() {}.valueOf());
+ }
+ expect: {
+ console.log("function");
+ }
+ expect_stdout: "function"
+}