3 # a simple component of unit testing which verifies that the input matches the output.
5 # the single parameter to the script is a file that contains the correct answer.
7 source "$FEISTY_MEOW_SCRIPTS/core/functions.sh"
9 answer_file="$1"; shift
11 if [ -z "$answer_file" -o ! -f "$answer_file" ]; then
12 echo This script needs a parameter which is a valid file filled with the
13 echo correct version of the input.
17 input_save_file="$(mktemp "$TMP/zz_verify_input.XXXXXX")"
20 echo $line >>"$input_save_file"
23 diff -q "$input_save_file" "$answer_file"
26 echo "The provided input differs from the correct answer!"
27 echo -e "\nAnswer file has:\n=============="
29 echo -e "==============\nBut the input data has:\n=============="
30 cat "$input_save_file"
31 echo -e "=============="
33 false # set bad exit value.