Improve tests

This commit is contained in:
Ethan P 2019-10-22 15:21:12 -07:00
parent 763d34d9c9
commit fa8a3bb850
No known key found for this signature in database
GPG Key ID: 6963FD04F6CF35EA
6 changed files with 24 additions and 8 deletions

View File

@ -79,6 +79,13 @@ display_test_summary() {
# -----------------------------------------------------------------------------
if [ -n "$1" ]; then
test_types="$("$HERE/util/test-exec.sh" --supports)"
if ! grep -F "$1" <<< "$test_types" &>/dev/null; then
printc "%{RED}Unknown test type: %s%{CLEAR}\n" "$1"
printc "%{RED}Supported types:%{CLEAR}\n%s\n" "$test_types"
exit 2
fi
run_all_tests "$1"
exit_status=$?
display_test_summary

View File

@ -1,4 +1,3 @@
set -e
"$TEST_RUNNER" batgrep "ca" file.txt
"$TEST_RUNNER" batgrep "ca" link.txt

View File

@ -5,10 +5,3 @@ car
frog
fox
────────────────────────────────────────────────────────────────────────────────
────────────────────────────────────────────────────────────────────────────────
cat
dog
car
frog
fox
────────────────────────────────────────────────────────────────────────────────

View File

@ -0,0 +1,3 @@
set -e
"$TEST_RUNNER" batgrep "ca" link.txt

View File

@ -0,0 +1,7 @@
────────────────────────────────────────────────────────────────────────────────
cat
dog
car
frog
fox
────────────────────────────────────────────────────────────────────────────────

View File

@ -80,6 +80,13 @@ case "$1" in
fi
};;
--supports) {
echo "snapshot-generate"
echo "snapshot-test"
echo "consistency-test"
exit 0
};;
*) {
printf "\x1B[31mUnknown subcommand.\x1B[0m\n"
printf " - \x1B[33msnapshot-generate\x1B[0m -- generate new snapshots\n"