aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-02-02 17:39:30 +0000
committerGitHub <noreply@github.com>2021-02-02 17:39:30 +0000
commita2f27c7640fee2c981b49ee484a37e1721622bb3 (patch)
tree67ce8a676c7590f7857b3475cbaee59cd5ca28eb /test
parent3c556b8689346f8256781455c0e1b2f00975570f (diff)
downloadtracifyjs-a2f27c7640fee2c981b49ee484a37e1721622bb3.tar.gz
tracifyjs-a2f27c7640fee2c981b49ee484a37e1721622bb3.zip
fix corner cases in `templates` (#4610)
Diffstat (limited to 'test')
-rw-r--r--test/compress/templates.js48
1 files changed, 47 insertions, 1 deletions
diff --git a/test/compress/templates.js b/test/compress/templates.js
index 3c7957f8..0be46df0 100644
--- a/test/compress/templates.js
+++ b/test/compress/templates.js
@@ -134,7 +134,7 @@ partial_evaluate: {
node_version: ">=4"
}
-malformed_evaluate: {
+malformed_evaluate_1: {
options = {
evaluate: true,
templates: true,
@@ -149,6 +149,52 @@ malformed_evaluate: {
node_version: ">=4"
}
+malformed_evaluate_2: {
+ options = {
+ evaluate: true,
+ templates: true,
+ }
+ input: {
+ console.log(`\u0${0}b${5}`);
+ }
+ expect: {
+ console.log(`\u0${0}b5`);
+ }
+ expect_stdout: true
+ node_version: ">=4"
+}
+
+malformed_evaluate_3: {
+ options = {
+ evaluate: true,
+ templates: true,
+ }
+ input: {
+ console.log(`\u${0}b${5}`);
+ }
+ expect: {
+ console.log(`\u0b5`);
+ }
+ expect_stdout: true
+ node_version: ">=4"
+}
+
+malformed_evaluate_4: {
+ options = {
+ evaluate: true,
+ templates: true,
+ unsafe: true,
+ }
+ input: {
+ console.log(String.raw`\u0${0}b${5}`);
+ }
+ expect: {
+ console.log("\\u00b5");
+ }
+ expect_stdout: "\\u00b5"
+ node_version: ">=8"
+}
+
unsafe_evaluate: {
options = {
evaluate: true,