truncate helptext

This commit is contained in:
Olof hagsand 2016-03-09 21:01:57 +01:00
parent 4b19798b58
commit 6d8acdea9f
9 changed files with 102 additions and 44 deletions

View file

@ -3,7 +3,7 @@
testnr=0
testnname=
clixon_cf=/usr/local/etc/routing.conf
# error and exit
# error and exit, arg is optional extra errmsg
err(){
echo "Error in Test$testnr [$testname] $1"
exit $testnr
@ -18,14 +18,23 @@ new(){
}
# clicon_cli tester. First arg is command and second is expected outcome
clifn(){
expectfn(){
cmd=$1
expect=$2
ret=`$cmd`
if [ $? -ne 0 ]; then
err
fi
if [ "$ret" != "$expect" ]; then
# Match if both are empty string
if [ -z "$ret" -a -z "$expect" ]; then
return
fi
match=`echo "$ret" | grep -Eo "$expect"`
# echo "ret:$ret"
# echo "expect:$expect"
# echo "match:$match"
if [ -z "$match" ]; then
err "\nExpected:\t\"$expect\"\nGot:\t\"$ret\""
fi
}