## -*- sh -*- ## ## Replace 'inifile_test' with test name ## ## inifile.test - Test driver for IniFile class. ## ## $Id: inifile.test,v 1.3 2005/01/07 02:28:57 vlg Exp $ # Common definitions if test -z "$srcdir" ; then srcdir=`echo "$0" | sed 's,[^/]*$,,'` test "$srcdir" = "$0" && srdir=. test -z "$srcdir" && srcdir=. test "${VERBOSE+set}" != set && VERBOSE=1 fi . $srcdir/defs # this is the output we should expect to see cat <<\EOF >ok = Running inifile_test Test = Testing load() ... ok Testing sync(file) ... ok Testing get_value() ... ok Testing add_section() / set_pair() ... ok Testing iteration through list of sections ... options History Default Interface ok Testing iteration through a section ... 0=/Segment25/Segment25.gwm 1=/Segment26/Segment26.gwm 2=/Segment27/Segment27.gwm ok Testing drop_pair() ... ok Testing drop_section() ... ok Testing drop_all() ... ok inifile_test Passed EOF # Unexpected output cat <<\EOF >errok EOF # You can specify command-line arguments here RUNTEST="${top_builddir}/tests/inifile_test" # Run test $RUNTEST 2> err | tee -i out >&2 # Test against expected output if ${CMP} -s out ok; then : else echo "ok:" >&2 cat ok >&2 exit 1 fi # Mungle error output to remove leading directories, 'lt-' or # trailing '.exe' sed -e "s,^[^:]*[lt-]*inifile_test[.ex]*:,inifile_test;," err >sederr && mv sederr err # Show stderr if doesn't match expected output if VERBOSE=1 if "$CMP" -s err errok; then : else echo "err:" >&2 cat err >&2 echo "errok:" >&2 cat errok >&2 exit 1 fi