aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoralexlamsl <alexlamsl@gmail.com>2017-02-18 19:22:24 +0800
committeralexlamsl <alexlamsl@gmail.com>2017-02-21 13:29:58 +0800
commit974247c8c0e57901ef776e86784c8c9a1b87b5de (patch)
tree308ab620fca91f6eb2389674ed048fa43cb8b9b0 /test
parenta0f4fd390a0a1af80964aab9754bf5358db575e2 (diff)
downloadtracifyjs-974247c8c0e57901ef776e86784c8c9a1b87b5de.tar.gz
tracifyjs-974247c8c0e57901ef776e86784c8c9a1b87b5de.zip
evaluate AST_SymbolRef as parameter
fix invalid boolean conversion now exposed in `make_node_from_constant()` closes #1477
Diffstat (limited to 'test')
-rw-r--r--test/compress/evaluate.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js
index 0ff157dc..f88bc538 100644
--- a/test/compress/evaluate.js
+++ b/test/compress/evaluate.js
@@ -598,3 +598,50 @@ unsafe_prototype_function: {
var h = "" + ({toString: 0});
}
}
+
+call_args: {
+ options = {
+ evaluate: true,
+ }
+ input: {
+ const a = 1;
+ console.log(a);
+ +function(a) {
+ return a;
+ }(a);
+ }
+ expect: {
+ const a = 1;
+ console.log(1);
+ +function(a) {
+ return a;
+ }(1);
+ }
+}
+
+in_boolean_context: {
+ options = {
+ booleans: true,
+ evaluate: true,
+ }
+ input: {
+ !42;
+ !"foo";
+ ![1, 2];
+ !/foo/;
+ !b(42);
+ !b("foo");
+ !b([1, 2]);
+ !b(/foo/);
+ }
+ expect: {
+ !1;
+ !1;
+ !1;
+ !1;
+ !b(42);
+ !b("foo");
+ !b([1, 2]);
+ !b(/foo/);
+ }
+}