From e722dd01299ba4d03a1b409a8bceddda55ba7bc0 Mon Sep 17 00:00:00 2001 From: Matthew Vernon Date: Sun, 22 Aug 2021 12:21:49 +0100 Subject: [PATCH] Add a test suite for use with autopkgtest This should make sure the package is working properly in future... --- debian/tests/bible-tests.sh | 16 ++++++++++++++++ debian/tests/control | 3 +++ 2 files changed, 19 insertions(+) create mode 100755 debian/tests/bible-tests.sh create mode 100644 debian/tests/control diff --git a/debian/tests/bible-tests.sh b/debian/tests/bible-tests.sh new file mode 100755 index 0000000..ecab3a3 --- /dev/null +++ b/debian/tests/bible-tests.sh @@ -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 index 0000000..6c05e81 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,3 @@ +#Autopkg tests for the Bible package +Tests: bible-tests.sh +Restrictions: allow-stderr -- 2.30.2