#! /bin/sh # -*- Mode: Shell-script -*- # ---------------------------------------------------------------------- # stdopts.test --- test standard options # # Time-stamp: "2007-07-04 10:11:16 bkorb" # Author: Bruce Korb ## ## This file is part of AutoOpts, a companion to AutoGen. ## AutoOpts is free software. ## AutoOpts is copyright (c) 1992-2007 by Bruce Korb - all rights reserved ## ## AutoOpts is available under any one of two licenses. The license ## in use must be one of these two and the choice is under the control ## of the user of the license. ## ## The GNU Lesser General Public License, version 3 or later ## See the files "COPYING.lgplv3" and "COPYING.gplv3" ## ## The Modified Berkeley Software Distribution License ## See the file "COPYING.mbsd" ## ## These files have the following md5sums: ## ## 239588c55c22c60ffe159946a760a33e pkg/libopts/COPYING.gplv3 ## fa82ca978890795162346e661b47161a pkg/libopts/COPYING.lgplv3 ## 66a5cedaf62c4b2637025f049f9b826f pkg/libopts/COPYING.mbsd # # $Id: stdopts.test,v 4.7 2007/07/04 21:36:40 bkorb Exp $ # ---------------------------------------------------------------------- . ./defs # # # # # # # # # # DEFINITIONS FILE # # # # # # # # # echo "creating ${testname}.def in `pwd`" cat > ${testname}.def <<- _EOF_ AutoGen Definitions options; prog-name = test_${testname}; prog-title = "${testname} test"; config-header = 'config.h'; test-main; long-opts; #define VERBOSE_ENUM #define VERBOSE_FLAG #include stdoptions _EOF_ ${AG_L} ${testname}.def || \ failure AutoGen could not process compile "-?" # # # # # # # # # # HELP OUTPUT FILE # # # # # # # # # echo creating ${testname}.hlp cat > ${testname}.hbase <<- _EOF_ test_stdopts - stdopts test USAGE: stdopts [ - [] | --[{=| }] ]... The following options are commonly used and are provided and supported by AutoOpts: Flg Arg Option-Name Description -V KWd verbose run program with progress info version and help options: Flg Arg Option-Name Description -? no help Display usage information and exit -! no more-help Extended usage information passed thru pager Options are specified by doubled hyphens and their name or by a single hyphen and the flag character. The valid "verbose" option keywords are: silent quiet brief informative verbose _EOF_ # When building with DEBUG set, we get an unanticipated option: # ${GREP} -v 'run program with debugging info' ${testname}.help > ${testname}.hres cmp -s ${testname}.h[br]* || \ failure "`diff ${testname}.h[br]*`" ./${testname} --verbose=exp > /dev/null 2>&1 && \ failure ${testname} accepted ambiguous keyword ./${testname} --verbose=inf > ${testname}.out || \ failure ${testname} did not handle its options cat > ${testname}.oex <<_EOF_ OPTION_CT=1 export OPTION_CT TEST_STDOPTS_VERBOSE='informative' export TEST_STDOPTS_VERBOSE _EOF_ cmp -s ${testname}.o* || \ failure "`diff ${testname}.o??`" cleanup ## Local Variables: ## Mode: shell-script ## indent-tabs-mode: nil ## sh-indentation: 2 ## End: # end of stdopts.test