Expect a grammar-only layout error, a bare record spelling and a Swedish title table
This commit is contained in:
+2
-2
@@ -331,8 +331,8 @@ func TestBuiltinLayoutErrorsNameARunnableSpelling(t *testing.T) {
|
|||||||
t.Errorf("%v names a layout that renders its own quotes", err)
|
t.Errorf("%v names a layout that renders its own quotes", err)
|
||||||
}
|
}
|
||||||
_, err = compile(parse(t, `"{time(15:04)}"`))
|
_, err = compile(parse(t, `"{time(15:04)}"`))
|
||||||
if err == nil || !strings.Contains(err.Error(), "write '15:04'") || !strings.Contains(err.Error(), "shell") {
|
if err == nil || !strings.Contains(err.Error(), "write '15:04'") {
|
||||||
t.Fatalf("a bare layout = %v, want it named quoted and the shell explained", err)
|
t.Fatalf("a bare layout = %v, want it named quoted", err)
|
||||||
}
|
}
|
||||||
// The comma hint belongs to a layout that split, not to a call given extra args.
|
// The comma hint belongs to a layout that split, not to a call given extra args.
|
||||||
_, err = compile(parse(t, `"{time(0,12,'15:04')}"`))
|
_, err = compile(parse(t, `"{time(0,12,'15:04')}"`))
|
||||||
|
|||||||
@@ -413,4 +413,10 @@ func TestShippedUSTitleAgreesWithSex(t *testing.T) {
|
|||||||
t.Errorf("en_US.person.prefix never drew %q in 3000 draws", want)
|
t.Errorf("en_US.person.prefix never drew %q in 3000 draws", want)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
swedish := map[string]bool{"dr": true, "prof": true}
|
||||||
|
for i := 0; i < 50; i++ {
|
||||||
|
if got := fake(t, f, "sv_SE.title"); !swedish[got] {
|
||||||
|
t.Fatalf("sv_SE.title = %q, want an unsexed Swedish honorific", got)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -553,7 +553,7 @@ func TestRecordTemplateRejectsATopLevelRepeat(t *testing.T) {
|
|||||||
// error names the record that gives it one.
|
// error names the record that gives it one.
|
||||||
func TestRecordOfAFieldlessCategoryNamesTheWrapper(t *testing.T) {
|
func TestRecordOfAFieldlessCategoryNamesTheWrapper(t *testing.T) {
|
||||||
f := newGenerator(t, "data", WithSeed(1))
|
f := newGenerator(t, "data", WithSeed(1))
|
||||||
want := `'{"format":"","personnummer":"{/sv_SE.personnummer}"}'`
|
want := `{"format":"","personnummer":"{/sv_SE.personnummer}"}`
|
||||||
_, err := f.FakeRecord("sv_SE.personnummer")
|
_, err := f.FakeRecord("sv_SE.personnummer")
|
||||||
if err == nil || !strings.Contains(err.Error(), want) {
|
if err == nil || !strings.Contains(err.Error(), want) {
|
||||||
t.Fatalf("FakeRecord(sv_SE.personnummer) = %v, want it to name %s", err, want)
|
t.Fatalf("FakeRecord(sv_SE.personnummer) = %v, want it to name %s", err, want)
|
||||||
|
|||||||
Reference in New Issue
Block a user