Skip to content

Commit b89301a

Browse files
committed
test: cover broader non-Latin script matrix in UrlTitle
Reviewer pointed out the fix changes slug generation for many non-Latin scripts, not just Arabic. Pin the actual behavior across Thai, Japanese hiragana, Korean, Hebrew, and Cyrillic so the test surface matches the real scope of the change. Also pin the pre-existing Japanese-kanji-via-pinyin path so reviewers can see it is unchanged by this PR.
1 parent da2f3ab commit b89301a

1 file changed

Lines changed: 39 additions & 3 deletions

File tree

pkg/htmltext/htmltext_test.go

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,50 @@ func TestUrlTitleTable(t *testing.T) {
116116
want: "zhe-shi-yi-ge-biao-ti",
117117
},
118118
{
119-
name: "pure arabic transliterated",
119+
// The fix: previously collapsed to "topic" for all of these scripts.
120+
// Outputs are an ASCII approximation, not linguistically correct
121+
// romanization — see PR description.
122+
name: "arabic transliterated",
120123
title: "كيف حالك",
121124
want: "kyf-hlk",
122125
},
123126
{
124127
name: "mixed latin and arabic",
125-
title: "hello كيف",
126-
want: "hello-kyf",
128+
title: "مرحبا hello",
129+
want: "mrhb-hello",
130+
},
131+
{
132+
name: "thai transliterated",
133+
title: "ไทย ไทย",
134+
want: "aithy-aithy",
135+
},
136+
{
137+
name: "japanese hiragana transliterated",
138+
title: "こんにちは",
139+
want: "konnichiha",
140+
},
141+
{
142+
// Japanese with Han-block kanji is caught by the pre-existing pinyin
143+
// pre-step (Chinese reading, not Japanese), so this path is unchanged
144+
// by this PR. Pinning to document the existing behavior.
145+
name: "japanese kanji goes through pinyin path unchanged",
146+
title: "日本",
147+
want: "ri-ben",
148+
},
149+
{
150+
name: "korean transliterated",
151+
title: "안녕하세요",
152+
want: "annyeonghaseyo",
153+
},
154+
{
155+
name: "hebrew transliterated",
156+
title: "שלום עולם",
157+
want: "shlvm-vlm",
158+
},
159+
{
160+
name: "cyrillic transliterated",
161+
title: "Привет мир",
162+
want: "privet-mir",
127163
},
128164
{
129165
name: "emoji only falls back to topic",

0 commit comments

Comments
 (0)