#!/usr/bin/env bash
t=${0##*/}; TEST_NAME=${t:5}   # basename $0 with 'test-' stripped off

[ -z "$builddir" ] && export builddir=$PWD
. ${builddir}/check-common.sh

FILTERED_TEST_FILE="/tmp/${TEST_NAME}-filtered.check"

debugged_script="$top_builddir/test/example/settrace.sh"
(cd $srcdir && $SH ${TEST_NAME}.tests > $TEST_FILE 2>&1 < /dev/null)

/usr/bin/grep -v "run term-highlight. Setting forced off" $TEST_FILE | \
    /usr/bin/grep -v "Syntax highlight in source listings is off.$"  | \
    /usr/bin/sed -e "s:main(.*) called from file \`settrace.sh' at line 0:main() called from file \`settrace.sh' at line 0:" \
 >${FILTERED_TEST_FILE}

check_output $FILTERED_TEST_FILE $RIGHT_FILE
rc=$?

((0 != rc)) && exit $rc
rm $TEST_FILE

# Return code tells testing mechanism whether passed or not.
exit 0
