diff options
author | 2021-11-15 15:38:49 -0800 | |
---|---|---|
committer | 2021-11-15 15:38:49 -0800 | |
commit | 1a60d7df9836df2ffc6a7a02ff4f90f3cccf599f (patch) | |
tree | f4e5a698bd2773f55e3698f274b1bbea76b26c1a /integration | |
parent | 89a7e3bf2f45f94420dba8f24bdd3d6de7480d31 (diff) | |
download | bun-1a60d7df9836df2ffc6a7a02ff4f90f3cccf599f.tar.gz bun-1a60d7df9836df2ffc6a7a02ff4f90f3cccf599f.tar.zst bun-1a60d7df9836df2ffc6a7a02ff4f90f3cccf599f.zip |
[JS Printer] Fix bug with template literals
Diffstat (limited to 'integration')
-rw-r--r-- | integration/scripts/snippets.json | 3 | ||||
-rw-r--r-- | integration/snippets/template-literal.js | 37 |
2 files changed, 39 insertions, 1 deletions
diff --git a/integration/scripts/snippets.json b/integration/scripts/snippets.json index 233d508d8..a37394c1c 100644 --- a/integration/scripts/snippets.json +++ b/integration/scripts/snippets.json @@ -22,5 +22,6 @@ "/latin1-chars-in-regexp.js", "/jsx-spacing.jsx", "/jsx-entities.jsx", - "/optional-chain-with-function.js" + "/optional-chain-with-function.js", + "/template-literal.js" ] diff --git a/integration/snippets/template-literal.js b/integration/snippets/template-literal.js new file mode 100644 index 000000000..b65f1a6b1 --- /dev/null +++ b/integration/snippets/template-literal.js @@ -0,0 +1,37 @@ +const css = (templ) => templ.toString(); + +const fooNoBracesUTF8 = css` + before + /* */ + after +`; + +const fooNoBracesUT16 = css` + before + 🙃 + after +`; +const fooUTF8 = css` + before + ${true} + after + +`; + +const fooUTF16 = css` + before + 🙃 ${true} + after + +`; +export function test() { + for (let foo of [fooNoBracesUT16, fooNoBracesUTF8, fooUTF16, fooUTF8]) { + console.assert( + foo.includes("before"), + `Expected ${foo} to include "before"` + ); + console.assert(foo.includes("after"), `Expected ${foo} to include "after"`); + } + + return testDone(import.meta.url); +} |