aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-06-01 00:56:28 +0800
committerGitHub <noreply@github.com>2017-06-01 00:56:28 +0800
commit17e73121fa641c14fd9f4cdd3310bf3e8ec037d0 (patch)
treed24c9fdaf9789f97bf611a01fda99ba4061f8bfd /test
parentf71e8fd9488b28b92e6897254b7a54cf51471557 (diff)
downloadtracifyjs-17e73121fa641c14fd9f4cdd3310bf3e8ec037d0.tar.gz
tracifyjs-17e73121fa641c14fd9f4cdd3310bf3e8ec037d0.zip
enhance `unsafe` `evaluate` (#2037)
Diffstat (limited to 'test')
-rw-r--r--test/compress/evaluate.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js
index a1e3d0be..020d7cf3 100644
--- a/test/compress/evaluate.js
+++ b/test/compress/evaluate.js
@@ -1037,3 +1037,31 @@ issue_1964_2: {
}
expect_stdout: "b"
}
+
+array_slice_index: {
+ options = {
+ evaluate: true,
+ unsafe: true,
+ }
+ input: {
+ console.log([1,2,3].slice(1)[1]);
+ }
+ expect: {
+ console.log(3);
+ }
+ expect_stdout: "3"
+}
+
+string_charCodeAt: {
+ options = {
+ evaluate: true,
+ unsafe: true,
+ }
+ input: {
+ console.log("foo".charCodeAt("bar".length));
+ }
+ expect: {
+ console.log(NaN);
+ }
+ expect_stdout: "NaN"
+}