#!@SH_PROG@
# -*- shell-script -*-
t=${0##*/}; TEST_NAME=${t:5}   # basename $0 with 'test-' stripped off

[ -z "$builddir" ] && builddir=$PWD
. ${builddir}/check-common.sh
RIGHT_FILTERED_FILE="/tmp/${TEST_NAME}-filtered.right"

short_script_name=${1:-$TEST_NAME}
debugged_script="${top_srcdir}/test/example/${short_script_name}.sh"
(cd $srcdir && run_debugger "$debugged_script" 2>&1 >"$TEST_FILE" </dev/null)
@GREP@ -v '1:	#!@SH_PROG@' "$TEST_FILE" >"${TEST_FILTERED_FILE}"
@GREP@ -v '1:	#!/bin/bash' "$RIGHT_FILE" >"${RIGHT_FILTERED_FILE}"

check_output "$TEST_FILTERED_FILE" "$RIGHT_FILTERED_FILE"
rc=$? 
if ((0 == rc)) ; then
  rm -f $TEST_FILE
  rm -f $RIGHT_FILTERED_FILE
fi

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