diff options
Diffstat (limited to 'internal/bible/validate_test.go')
| -rw-r--r-- | internal/bible/validate_test.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/internal/bible/validate_test.go b/internal/bible/validate_test.go index 9cfec26..a3ed622 100644 --- a/internal/bible/validate_test.go +++ b/internal/bible/validate_test.go @@ -1,6 +1,9 @@ package bible -import "testing" +import ( + "strings" + "testing" +) func TestCheckCorpus(t *testing.T) { SetUserCorporaDir("testdata/corpora") @@ -21,4 +24,18 @@ func TestCheckCorpus(t *testing.T) { if r := CheckCorpus("badsystem"); r.OK() { t.Fatal("bad psalm_system not caught") } + // A verse present but a stub next to the Vulgate's (Genesis 1:1 = "x") is a + // warning, never an error -- the count-based checks can't see it. + if r := CheckCorpus("stub"); !hasWarning(r.Warnings, "suspiciously short") { + t.Fatalf("stub verse not warned; warnings: %v", r.Warnings) + } +} + +func hasWarning(ws []string, substr string) bool { + for _, w := range ws { + if strings.Contains(w, substr) { + return true + } + } + return false } |
