From 2d1a454026800bdcdcc5c8e46b2c4d2e75d0107b Mon Sep 17 00:00:00 2001 From: alcah Date: Tue, 17 Mar 2020 23:37:19 +1030 Subject: [PATCH] add return code test --- tests/t_return_code | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 tests/t_return_code diff --git a/tests/t_return_code b/tests/t_return_code new file mode 100755 index 0000000..9a4a761 --- /dev/null +++ b/tests/t_return_code @@ -0,0 +1,22 @@ +#!/bin/sh + +SDCV="$1" +TEST_DIR="$2" + +unset SDCV_PAGER + +test_return_code() { + WORD=$1 + EXPECTED=$2 + $SDCV -e -n --data-dir "$TEST_DIR" -u "Test synonyms" $WORD > /dev/null + RC=$? + if [ $RC -ne $EXPECTED ]; then + echo "Return code for $WORD should be '$EXPECTED' but was '$RC'" + exit 1 + fi +} + +test_return_code testawordy 0 +test_return_code testawordies 2 + +exit 0