X-Git-Url: https://git.grml.org/?p=grml-debootstrap.git;a=blobdiff_plain;f=tests%2Ftest_cmdlineopts.sh;fp=tests%2Ftest_cmdlineopts.sh;h=0000000000000000000000000000000000000000;hp=c1df0d6aab84a670ede08bd0640aa53c778d6591;hb=a8eeda3e2d78607046e63866197995fc5ea4bd14;hpb=dc30725ff4161de8483b56aec7af7874ad949192 diff --git a/tests/test_cmdlineopts.sh b/tests/test_cmdlineopts.sh deleted file mode 100755 index c1df0d6..0000000 --- a/tests/test_cmdlineopts.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - - -test_cmdlineopts() { - . ../cmdlineopts.clp - CMDLINE= - typeset -a VALUES - count=0 - i=0 - - OLDIFS="$IFS" - IFS=, - for CMD in $CMDLINE_OPTS ; do - PARAM="" - DELIM=" " - # check if CMD is optional - if [[ $CMD == *:: ]] ; then - DELIM="=" - fi - # CMD expects additional parameter - if [[ $CMD == *: ]] ; then - PARAM=$RANDOM - fi - VALUES[$count]="${CMD%%:*}$DELIM$PARAM" - ((count++)) - done - IFS=$OLDIFS - - # build the commandline - while [ "$i" -lt "$count" ] ; do - CMDLINE+="--${VALUES[$i]} " - ((i++)) - done - - . ../cmdlineopts.clp $CMDLINE - - - i=0 - # check the result against input - while [ "$i" -lt "$count" ] ; do - ENTRY="${VALUES[$i]}" - VARNAME=${ENTRY% *} - VARNAME=${VARNAME%=*} - RESULT=${ENTRY/* /} - RESULT=${RESULT/*=/} - VARNAME='$_opt_'${VARNAME/-/_} - VALUE="$(eval echo $VARNAME)" - if [ -z "$RESULT" ] ; then - assertNotNull "$VARNAME should be not null" "$VALUE" - else - assertEquals "$VARNAME" "$RESULT" "$VALUE" - fi - ((i++)) - done -} - -SHUNIT_PARENT=$0 -. /usr/share/shunit2/shunit2