Restructuring of test setup.
[gedcom-parse.git] / t / test_script
index cec97924296073ea097f571ec8ddc43287fd77ff..cd943a33c6bd3f11fdd2b21dc44c827a31674b2f 100755 (executable)
@@ -2,15 +2,35 @@
 # $Id$
 # $Name$
 
+options="-q"
+
+while [ $# -gt 0 ]
+do
+  case "$1" in
+    -*) options="$options $1";;
+    *)  break;;
+  esac
+  shift
+done
+
 file=$1
+expected_result=$2
+if [ -z "$expected_result" ]
+then
+  expected_result=0
+fi
 
 builddir=`pwd`
 cd $srcdir/..
-export GCONV_PATH=$GCONV_PATH:./ansel
-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$builddir/../gedcom/.libs
+export GCONV_PATH=./ansel:$GCONV_PATH
+export LD_LIBRARY_PATH=$builddir/../gedcom/.libs:$LD_LIBRARY_PATH
 cp $builddir/../ansel/.libs/ANSI_Z39.47.so ansel
-echo "=== testing $file"
-$builddir/../testgedcom -2 t/$file
+$builddir/../testgedcom $options t/input/$file
 result=$?
 rm ansel/ANSI_Z39.47.so
-exit $result
+if [ "$result" -eq "$expected_result" ]
+then
+  exit 0
+else
+  exit 1
+fi