From 331f4a1393c481e8abe8793597332e14dfe3e07e Mon Sep 17 00:00:00 2001 From: yetone Date: Mon, 9 Nov 2026 20:14:03 +0800 Subject: [PATCH] gui tests: a comment line doesn't say a plugin's words (#5332, #5327, #5426, #5482) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit i18n-keys' "a plugin's words are its own" has been red on main since 73c98ebc2 and was filed four times with no owner. Each red was a Go comment citing a word from the window: search_row_archive_test.go's "(View routing, the …", trace.go's '"No session ID")' and skills_shared_copy_test.go's "Use the library's sets …". A comment says nothing to the window, so whole-line // comments in .go and .js are left out of the scan. Words in code are still found. Run on mote at this tree (on origin/main c9a1c557d): - node --test i18n-keys.test.cjs: 4 pass, 0 fail (was 1 fail on e3f1efdaa, the same three words). Broken by hand: a code line t("View routing") in app.js turns it red ("plugins/usage/i18n.js "View routing": internal/gui/assets/app.js says it too"). --- internal/gui/tests/i18n-keys.test.cjs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/gui/tests/i18n-keys.test.cjs b/internal/gui/tests/i18n-keys.test.cjs index f1499b64e..857886ecb 100644 --- a/internal/gui/tests/i18n-keys.test.cjs +++ b/internal/gui/tests/i18n-keys.test.cjs @@ -46,7 +46,14 @@ test("a plugin's words are its own", () => { const p = path.join(d, e.name); if (e.isDirectory()) { if (!["node_modules", ".git", "site", "tests", "testdata", "docs"].includes(e.name)) walk(p); - } else if (/\.(go|js|html|css)$/.test(e.name) && e.name !== "i18n.js") texts.push([p, fs.readFileSync(p, "utf8")]); + } else if (/\.(go|js|html|css)$/.test(e.name) && e.name !== "i18n.js") { + let text = fs.readFileSync(p, "utf8"); + // a comment line says nothing to the window: Go's "(View routing, + // the …" and "Use the library's sets …" cite a plugin's words + // (#5332, #5327, #5426, #5482) + if (/\.(go|js)$/.test(e.name)) text = text.split("\n").filter((l) => !/^\s*\/\//.test(l)).join("\n"); + texts.push([p, text]); + } } }; walk(repo);