From 88cea346da0559fda48bb0efc8a392162ef8b5d1 Mon Sep 17 00:00:00 2001
From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com>
Date: Thu, 14 Dec 2023 16:23:41 -0500
Subject: [PATCH] Reproduce issue described in
https://github.com/embroider-build/content-tag/issues/45
---
test/node-api.cjs | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/test/node-api.cjs b/test/node-api.cjs
index 0b8c013..63be9ee 100644
--- a/test/node-api.cjs
+++ b/test/node-api.cjs
@@ -37,6 +37,37 @@ describe("parse", function () {
]);
});
+ it("multi-byte characters", function () {
+ let contentLength = "안녕하세요 세계".length;
+ let openLength = "".length;
+ let closeLength = "".length;
+ let output = p.parse("안녕하세요 세계");
+
+ expect(output).to.eql([
+ {
+ type: "expression",
+ tagName: "template",
+ contents: "안녕하세요 세계",
+ range: {
+ start: 0,
+ end: openLength + contentLength + closeLength,
+ },
+ contentRange: {
+ start: openLength,
+ end: openLength + contentLength,
+ },
+ startRange: {
+ end: openLength,
+ start: 0,
+ },
+ endRange: {
+ start: openLength + contentLength - 1,
+ end: openLength + contentLength + closeLength,
+ },
+ },
+ ]);
+ });
+
it("expression position", function () {
let output = p.parse("const tpl = Hello!");