Answer stability round 2: let the selector be the assertion
This commit is contained in:
+3
-9
@@ -270,9 +270,7 @@ func TestShippedPersonNames(t *testing.T) {
|
|||||||
seen[fake(t, f, locale+".sex[f].first-name")] = true
|
seen[fake(t, f, locale+".sex[f].first-name")] = true
|
||||||
got := fakeTemplate(t, f, `{/`+locale+`.person.first}|{/`+locale+`.person.sex}`)
|
got := fakeTemplate(t, f, `{/`+locale+`.person.first}|{/`+locale+`.person.sex}`)
|
||||||
first, sex, _ := strings.Cut(got, "|")
|
first, sex, _ := strings.Cut(got, "|")
|
||||||
if v := fake(t, f, locale+".sex["+sex+"].first-name["+first+"]"); v != first {
|
fake(t, f, locale+".sex["+sex+"].first-name["+first+"]")
|
||||||
t.Fatalf("%s: %q: %q is not a %s name", locale, got, first, sex)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if len(seen) < 300 || !seen["Anna"] && locale == "sv_SE" || !seen["Mary"] && locale == "en_US" {
|
if len(seen) < 300 || !seen["Anna"] && locale == "sv_SE" || !seen["Mary"] && locale == "en_US" {
|
||||||
t.Fatalf("%s female first names: %d distinct in 2000, want a weighted register", locale, len(seen))
|
t.Fatalf("%s female first names: %d distinct in 2000, want a weighted register", locale, len(seen))
|
||||||
@@ -290,14 +288,10 @@ func TestShippedPersonIsOneNamedPick(t *testing.T) {
|
|||||||
got := fakeTemplate(t, f, `{/`+locale+`.person as a}{/`+locale+`.person as b}{a.first}|{a.sex}|{a.prefix}|{b.first}|{b.sex}`)
|
got := fakeTemplate(t, f, `{/`+locale+`.person as a}{/`+locale+`.person as b}{a.first}|{a.sex}|{a.prefix}|{b.first}|{b.sex}`)
|
||||||
parts := strings.Split(got, "|")
|
parts := strings.Split(got, "|")
|
||||||
for _, p := range [][2]string{{parts[0], parts[1]}, {parts[3], parts[4]}} {
|
for _, p := range [][2]string{{parts[0], parts[1]}, {parts[3], parts[4]}} {
|
||||||
if v := fake(t, f, locale+".sex["+p[1]+"].first-name["+p[0]+"]"); v != p[0] {
|
fake(t, f, locale+".sex["+p[1]+"].first-name["+p[0]+"]")
|
||||||
t.Fatalf("%s: %q: %q is not a %s name", locale, got, p[0], p[1])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if title := strings.TrimSpace(parts[2]); title != "" && locale == "en_US" {
|
if title := strings.TrimSpace(parts[2]); title != "" && locale == "en_US" {
|
||||||
if v := fake(t, f, "en_US.sex["+parts[1]+"].title["+title+"]"); v != title {
|
fake(t, f, "en_US.sex["+parts[1]+"].title["+title+"]")
|
||||||
t.Fatalf("%q: %q is not a %s title", got, title, parts[1])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
apart = apart || parts[0] != parts[3]
|
apart = apart || parts[0] != parts[3]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user