chiark / gitweb /
Add a test suite for use with autopkgtest
authorMatthew Vernon <matthew@debian.org>
Sun, 22 Aug 2021 11:21:49 +0000 (12:21 +0100)
committerMatthew Vernon <matthew@debian.org>
Sun, 22 Aug 2021 11:21:49 +0000 (12:21 +0100)
This should make sure the package is working properly in future...

debian/tests/bible-tests.sh [new file with mode: 0755]
debian/tests/control [new file with mode: 0644]

diff --git a/debian/tests/bible-tests.sh b/debian/tests/bible-tests.sh
new file mode 100755 (executable)
index 0000000..ecab3a3
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash -ex
+
+#Simple lookup - only 1 matching verse
+bible -f '??girl' | grep 'Jl3:3'
+
+#Simple lookup - 1840 matches, 2 header lines
+diff -u <( bible -f '??hath' | wc -l ) <(echo 1842)
+
+#Check text of a verse is correct
+bible -f Jn11:35 | grep -F "John11:35 Jesus wept."
+
+#Check search combination (cumbersome on the CLI)
+diff -u <( bible -f ??beginning "?a end" "?a year" | tail -1 ) <( echo "Dt11:12" )
+
+#Check output matches entire rawtext file (less header line)
+diff -u <( bible -f 'gen1:1-rev99:99' ) <( tail -n +2 bible.rawtext )
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644 (file)
index 0000000..6c05e81
--- /dev/null
@@ -0,0 +1,3 @@
+#Autopkg tests for the Bible package
+Tests: bible-tests.sh
+Restrictions: allow-stderr