Expand locale data sets; match tests against patterns instead of fixed sets

This commit is contained in:
lilleman
2026-06-08 16:02:58 +02:00
parent 770dcd72f2
commit e28b92090d
24 changed files with 250 additions and 143 deletions
+3 -6
View File
@@ -65,13 +65,10 @@ func TestShippedSwedishAddress(t *testing.T) {
}
}
localities := map[string]bool{
"Göteborg": true, "Linköping": true, "Malmö": true, "Stockholm": true,
"Uppsala": true, "Västerås": true, "Örebro": true,
}
locality := regexp.MustCompile(`^\p{L}+( \p{L}+)*$`)
for i := 0; i < 30; i++ {
if c := fake(t, f, "address.locality"); !localities[c] {
t.Fatalf("locality %q not in sv_SE data", c)
if c := fake(t, f, "address.locality"); !locality.MatchString(c) {
t.Fatalf("locality %q is not a Swedish place name", c)
}
}
}