package main import "testing" func TestLooksLikeName(t *testing.T) { cases := []struct { name string ok bool }{ // Latin: the usual case. {"Vaike", true}, {"Jean-Paul", true}, {"O'Brien", true}, {"Tarnished 2", true}, // Cyrillic. {"Иван", true}, {"Мария Петровна", true}, // Hangul. {"지우", true}, {"김민준", true}, // CJK: Han, Hiragana, and Katakana count as a single family // because Japanese mixes them in one name. {"田中", true}, // Han alone (also valid in Chinese) {"たろう", true}, // Hiragana alone {"タロウ", true}, // Katakana alone {"田中たかし", true}, // Han + Hiragana, typical Japanese name // Cases that MUST keep failing (regression, see CLAUDE.md): // Greek + Han mixed, the garbage a 64-bit pointer decodes into // when read as UTF-16. {"ᾘ䱷翶", false}, // Mixing two ACCEPTED families is still mixing: not a valid // name in any real language. {"Аnna", false}, // Cyrillic А + Latin nna // The usual rules: length, leading punctuation, digits-only. {"", false}, {"A", false}, {"WayTooLongOfANameToBeRealHonestly", false}, {"-Starts", false}, {"123", false}, {"Ok 123", true}, } for _, c := range cases { if got := looksLikeName(c.name); got != c.ok { t.Errorf("looksLikeName(%q) = %v, wanted %v", c.name, got, c.ok) } } }