Restructuring of test setup.
[gedcom-parse.git] / t / test_script
index 6ca9aa645be7ffcc6764143ef3601a2dcd580418..cd943a33c6bd3f11fdd2b21dc44c827a31674b2f 100755 (executable)
@@ -2,14 +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
-$builddir/../testgedcom -2 -q 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