aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar Dylan Conway <35280289+dylan-conway@users.noreply.github.com> 2023-07-21 01:35:06 -0700
committerGravatar GitHub <noreply@github.com> 2023-07-21 01:35:06 -0700
commitaa1ad7f009173ae01e41f005c563b902f53906c3 (patch)
tree90bde80bcbdf99055fdd705d4832eb9ad56c62b8 /test
parent21bb3b2bdd39297395c59e8fe49ae73c8dfc2bb7 (diff)
downloadbun-aa1ad7f009173ae01e41f005c563b902f53906c3.tar.gz
bun-aa1ad7f009173ae01e41f005c563b902f53906c3.tar.zst
bun-aa1ad7f009173ae01e41f005c563b902f53906c3.zip
string escape edgecase (#3717)bun-v0.7.0
* fix edgecase when joining rope strings with backtick * bonus bugfix in ts decorator * Update transpiler.test.js * Fix test --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Diffstat (limited to '')
-rw-r--r--test/bundler/bundler_string.test.ts8
-rw-r--r--test/transpiler/transpiler.test.js4
2 files changed, 6 insertions, 6 deletions
diff --git a/test/bundler/bundler_string.test.ts b/test/bundler/bundler_string.test.ts
index 3c2d7802c..45faaee3e 100644
--- a/test/bundler/bundler_string.test.ts
+++ b/test/bundler/bundler_string.test.ts
@@ -14,8 +14,8 @@ const templateStringTests: Record<string, TemplateStringTest> = {
// note for writing tests: .print is .trim()'ed due to how run.stdout works
Empty: { expr: '""', captureRaw: '""' },
NullByte: { expr: '"hello\0"', captureRaw: '"hello\0"' },
- EmptyTemplate: { expr: "``", captureRaw: "``" },
- ConstantTemplate: { expr: "`asdf`", captureRaw: "`asdf`" },
+ EmptyTemplate: { expr: "``", captureRaw: '""' },
+ ConstantTemplate: { expr: "`asdf`", captureRaw: '"asdf"' },
AddConstant: { expr: "`${7 + 6}`", capture: true },
AddConstant2: { expr: "`${7 + 6 + 96}`", capture: true },
AddConstant3: { expr: "`${0.1 + 0.2}`", print: true },
@@ -80,8 +80,8 @@ const templateStringTests: Record<string, TemplateStringTest> = {
FoldNested4: { expr: "`a${`b`}c${`${`${`${'d'}`}`}`}e`", capture: true },
FoldNested5: { expr: "`\\$${`d`}`", print: true }, // could be captured
FoldNested6: { expr: "`a\0${5}c\\${{$${`d`}e`", print: true },
- EscapedDollar: { expr: "`\\${'a'}`", captureRaw: "`\\${'a'}`" },
- EscapedDollar2: { expr: "`\\${'a'}\\${'b'}`", captureRaw: "`\\${'a'}\\${'b'}`" },
+ EscapedDollar: { expr: "`\\${'a'}`", captureRaw: "\"${'a'}\"" },
+ EscapedDollar2: { expr: "`\\${'a'}\\${'b'}`", captureRaw: "\"${'a'}${'b'}\"" },
};
describe("bundler", () => {
diff --git a/test/transpiler/transpiler.test.js b/test/transpiler/transpiler.test.js
index f83c00296..8c77dffe6 100644
--- a/test/transpiler/transpiler.test.js
+++ b/test/transpiler/transpiler.test.js
@@ -2809,7 +2809,7 @@ console.log(foo, array);
expectPrinted("'string' + `template`", `"stringtemplate"`);
- expectPrinted("`template` + 'string'", "`templatestring`");
+ expectPrinted("`template` + 'string'", '"templatestring"');
// TODO: string template simplification
// expectPrinted("'string' + `a${foo}b`", "`stringa${foo}b`");
@@ -3088,7 +3088,7 @@ console.log(foo, array);
expectPrinted_('const x = `str` + "``";', "const x = `str\\`\\``");
expectPrinted_('const x = `` + "`";', "const x = `\\``");
expectPrinted_('const x = `` + "``";', "const x = `\\`\\``");
- expectPrinted_('const x = "``" + ``;', 'const x = "``"');
+ expectPrinted_('const x = "``" + ``;', "const x = `\\`\\``");
});
});