aboutsummaryrefslogtreecommitdiff
path: root/internal/bible/validate_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/bible/validate_test.go')
-rw-r--r--internal/bible/validate_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/internal/bible/validate_test.go b/internal/bible/validate_test.go
new file mode 100644
index 0000000..9cfec26
--- /dev/null
+++ b/internal/bible/validate_test.go
@@ -0,0 +1,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")
+ }
+}