aboutsummaryrefslogtreecommitdiff
path: root/internal/bible/validate_test.go
blob: 9cfec26384dfb74afc1b1ff3d8a4a67ce9d4ab97 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package bible

import "testing"

func TestCheckCorpus(t *testing.T) {
	SetUserCorporaDir("testdata/corpora")
	t.Cleanup(func() { SetUserCorporaDir("") })

	if r := CheckCorpus("good"); !r.OK() {
		t.Fatalf("good corpus flagged: %v", r.Errors)
	}
	if r := CheckCorpus("badbook"); r.OK() {
		t.Fatal("unknown book not caught")
	}
	if r := CheckCorpus("gap"); len(r.Warnings) == 0 {
		t.Fatal("verse gap not warned")
	}
	if r := CheckCorpus("nosidecar"); r.OK() {
		t.Fatal("missing sidecar not caught")
	}
	if r := CheckCorpus("badsystem"); r.OK() {
		t.Fatal("bad psalm_system not caught")
	}
}