#!/bin/sh
#
# This is a simple script that tests clig
#
# install as: /usr/lib/debian-test/tests/clig
# or else as: /usr/lib/debian-test/tests/clig/test-1
# In the latter case, /usr/lib/debian-test/tests/clig/ can contain
# other file with test data and/or other scripts named test-2, test-3, etc.
#
# You can run this script with the command
#       sh debian/tests
# After installation, you can run it with the commands
#       /usr/lib/debian-test/tests/clig
# or
#       debian-test -v clig
# see debian-test(1)

. ${DEBIANTEST_LIB:-/usr/lib/debian-test/lib}/functions.sh

if [ -f my-data-file ]; then
    TESTDIR=`pwd`;
else
    TESTDIR=/usr/lib/debian-test/tests/clig;
fi


## Uncomment these lines if you need a scratch directory in which to execute

TMP=/tmp/clig-test.$$
test -e $TMP && rm -rf $TMP
mkdir $TMP
cd $TMP
trap "rm -rf $TMP" EXIT

test1(){
    RESULT=0
    cp /usr/share/doc/clig/examples/* .
    sh README.example  >/dev/null 2>&1
    ./cligExample -title foo -colors red -a 32 foobar | grep -q "title found"
}

runtest "construct example parser" test1

