"Fossies" - the Fresh Open Source Software Archive

Member "argbash-2.10.0/tests/regressiontests/Makefile" (22 Sep 2020, 33202 Bytes) of package /linux/privat/argbash-2.10.0.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "Makefile": 2.9.0_vs_2.10.0.

    1 TESTDIR ?= ../regressiontests
    2 PHONIES ?=
    3 
    4 NUL =
    5 
    6 ARGBASH_BIN = $(TESTDIR)/../../bin/argbash
    7 ARGBASH_1TO2 = $(TESTDIR)/../../bin/argbash-1to2
    8 ARGBASH_INIT = $(TESTDIR)/../../bin/argbash-init
    9 REVERSE = $(TESTDIR)/reverse
   10 
   11 ARGBASH_EXEC ?= $(ARGBASH_BIN)
   12 ARGBASH_INIT_EXEC ?= $(ARGBASH_INIT)
   13 
   14 %-dash.sh: %.m4 $(ARGBASH_BIN)
   15 	$(word 2,$^) --type posix-script -o $@ $<
   16 	sed -i "s|#!/bin/bash|#!$(shell which dash)|" $@
   17 
   18 %.sh: %.m4 $(ARGBASH_BIN)
   19 	$(word 2,$^) $< -o $@
   20 
   21 %.txt: %.m4 $(ARGBASH_BIN)
   22 	$(word 2,$^) $< -t docopt --strip all -o $@
   23 TESTS =
   24 TESTS_GEN =
   25 
   26 # presumably always-executed and created scripts
   27 SCRIPTS = \
   28 	$(TESTDIR)/basic2.sh \
   29 	$(TESTDIR)/test-salone.sh \
   30 	$(TESTDIR)/test-standalone2.sh \
   31 	$(TESTDIR)/test-ddash.m4 \
   32 	$(TESTDIR)/test-diy-noop.m4 \
   33 	$(TESTDIR)/test-diy-noop.sh \
   34 	$(TESTDIR)/test-diy.m4 \
   35 	$(TESTDIR)/test-wrapping-second_level.sh \
   36 	$(TESTDIR)/test-wrapping-single_level.sh \
   37 	$(TESTDIR)/otherdir/test-onlyopt.m4 \
   38 	$(TESTDIR)/test-wrapping-otherdir.sh \
   39 	$(TESTDIR)/otherdir/test-onlypos.m4 \
   40 	$(TESTDIR)/test-wrapping2.sh \
   41 	$(TESTDIR)/test-init_simple.sh \
   42 	$(TESTDIR)/test-init_simple.m4 \
   43 	$(TESTDIR)/test-init_simple-parsing.m4 \
   44 	$(TESTDIR)/test-init_simple-s.sh \
   45 	$(TESTDIR)/test-init_simple-s-parsing.sh \
   46 	$(TESTDIR)/test-init_simple-s-parsing.m4 \
   47 	$(TESTDIR)/test-init_simple-s.m4 \
   48 	$(TESTDIR)/regenerate-test-init-simple-s-update.m4 \
   49 	$(TESTDIR)/test-init_simple-s-update-parsing.sh \
   50 	$(TESTDIR)/test-init_simple-s-update-parsing.m4 \
   51 	$(TESTDIR)/regenerate-test-init_simple-s-update.m4 \
   52 	$(TESTDIR)/test-init_simple-s-update.m4 \
   53 	$(TESTDIR)/test-init_simple-ss-parsing.sh \
   54 	$(TESTDIR)/test-init_simple-ss-parsing.m4 \
   55 	$(TESTDIR)/test-init_simple-ss.sh \
   56 	$(TESTDIR)/gen-test-init_name_char.m4 \
   57 	$(TESTDIR)/gen-test-init_name_dash.m4 \
   58 	$(TESTDIR)/gen-test-group-wrong.m4 \
   59 	$(TESTDIR)/test-semi_strict.sh \
   60 	$(TESTDIR)/test-very_strict.sh \
   61 	$(TESTDIR)/test-getopt-equals.sh \
   62 	$(TESTDIR)/test-getopt-both.sh \
   63 	$(TESTDIR)/test-getopt-space.sh \
   64 	$(NUL)
   65 
   66 # bash tests
   67 TESTS += \
   68 	stability \
   69 	basic \
   70 	test-void \
   71 	call-salone \
   72 	test-most \
   73 	test-more \
   74 	test-onlypos \
   75 	test-onlypos-declared \
   76 	test-onlyopt \
   77 	stability-salone \
   78 	test-ddash \
   79 	test-simple \
   80 	test-diy-noop \
   81 	test-diy \
   82 	test-wrapping-second_level \
   83 	test-wrapping \
   84 	test-wrapping-otherdir \
   85 	test-wrapping-more \
   86 	test-wrapping-excl \
   87 	stability-wrapping \
   88 	test-infinity-minimal_call \
   89 	test-progs \
   90 	test-prog \
   91 	test-infinity \
   92 	test-infinity-nodefaults \
   93 	test-infinity-mixed \
   94 	test-leftovers \
   95 	test-delim-space \
   96 	test-delim-equals \
   97 	test-delim-both \
   98 	test-init_simple \
   99 	test-init_simple-s \
  100 	test-init_simple-ss \
  101 	test-init_simple-s-update \
  102 	test-env-base \
  103 	test-env-simple \
  104 	test-int \
  105 	test-group \
  106 	test-group-idx \
  107 	test-semi_strict \
  108 	test-very_strict \
  109 	test-getopt-both \
  110 	test-getopt-space \
  111 	test-getopt-equals \
  112 	$(NUL)
  113 
  114 # docopt tests
  115 TESTS += \
  116 	basic-docopt \
  117 	test-onlyopt-docopt \
  118 	$(NUL)
  119 
  120 TESTS_GEN += \
  121 	gen-test-pos \
  122 	gen-test-opt \
  123 	gen-test-pos2 \
  124 	gen-test-opt2 \
  125 	gen-test-infinity-illegal \
  126 	gen-test-bool-default \
  127 	gen-test-pos-opt \
  128 	gen-test-pos-opt2 \
  129 	gen-test-more \
  130 	gen-test-illegal-pos \
  131 	gen-test-illegal-opt \
  132 	gen-test-misspelled \
  133 	gen-test-unmatched_bracket \
  134 	gen-test-badcall-multi \
  135 	gen-test-init_name_dash \
  136 	gen-test-init_name_char \
  137 	gen-test-group-wrong \
  138 	$(NUL)
  139 
  140 SCRIPTS += \
  141 	$(TESTDIR)/basic.sh \
  142 	$(TESTDIR)/test-void.sh \
  143 	$(TESTDIR)/call-salone.sh \
  144 	$(TESTDIR)/test-most.sh \
  145 	$(TESTDIR)/test-more.sh \
  146 	$(TESTDIR)/test-onlypos.sh \
  147 	$(TESTDIR)/test-onlypos-declared.sh \
  148 	$(TESTDIR)/test-onlyopt.sh \
  149 	$(TESTDIR)/test-standalone.sh \
  150 	$(TESTDIR)/test-ddash.sh \
  151 	$(TESTDIR)/test-simple.sh \
  152 	$(TESTDIR)/test-diy-noop.sh \
  153 	$(TESTDIR)/test-diy.sh \
  154 	$(TESTDIR)/test-wrapping-second_level.sh \
  155 	$(TESTDIR)/test-wrapping.sh \
  156 	$(TESTDIR)/test-wrapping-otherdir.sh \
  157 	$(TESTDIR)/test-wrapping-more.sh \
  158 	$(TESTDIR)/test-wrapping-excl.sh \
  159 	$(TESTDIR)/test-infinity-minimal_call.sh \
  160 	$(TESTDIR)/test-progs.sh \
  161 	$(TESTDIR)/test-prog.sh \
  162 	$(TESTDIR)/test-infinity.sh \
  163 	$(TESTDIR)/test-infinity-nodefaults.sh \
  164 	$(TESTDIR)/test-infinity-mixed.sh \
  165 	$(TESTDIR)/test-leftovers.sh \
  166 	$(TESTDIR)/test-delim-space.sh \
  167 	$(TESTDIR)/test-delim-equals.sh \
  168 	$(TESTDIR)/test-delim-both.sh \
  169 	$(TESTDIR)/test-init_simple.sh \
  170 	$(TESTDIR)/test-init_simple-s.sh \
  171 	$(TESTDIR)/test-init_simple-ss.sh \
  172 	$(TESTDIR)/test-init_simple-s-update.sh \
  173 	$(TESTDIR)/test-env-base.sh \
  174 	$(TESTDIR)/test-env-simple.sh \
  175 	$(TESTDIR)/test-int.sh \
  176 	$(TESTDIR)/test-group.sh \
  177 	$(TESTDIR)/test-group-idx.sh \
  178 	$(TESTDIR)/test-semi_strict.sh \
  179 	$(TESTDIR)/test-very_strict.sh \
  180 	$(TESTDIR)/test-getopt-both.sh \
  181 	$(TESTDIR)/test-getopt-space.sh \
  182 	$(TESTDIR)/test-getopt-equals.sh \
  183 	$(TESTDIR)/basic.txt \
  184 	$(TESTDIR)/test-onlyopt.txt \
  185 	$(NUL)
  186 
  187 ifneq "$(shell which dash 2> /dev/null)" ""
  188 
  189 TESTS += \
  190 	basic-dash \
  191 	test-onlyopt-dash \
  192 	test-simple-dash \
  193 	$(NUL)
  194 
  195 TESTS_GEN += \
  196 	gen-test-infinity-dash \
  197 	gen-test-wrap-dash \
  198 	$(NUL)
  199 
  200 SCRIPTS += \
  201 	$(TESTDIR)/basic-dash.sh \
  202 	$(TESTDIR)/test-onlyopt-dash.sh \
  203 	$(TESTDIR)/test-simple-dash.sh \
  204 	$(NUL)
  205 
  206 endif
  207 
  208 TESTS += tests-gen
  209 
  210 define generic_regression_posix
  211 	$< LOO | grep -q 'POS_S=LOO',
  212 	$< "LOO BAR" | grep -q 'POS_S=LOO BAR,'
  213 	$< -b LOO | grep -q BOOL=on,
  214 	$< LOO | grep -q BOOL=off,
  215 	$< LOO | grep -q 'OPT_S=opt_arg_default lolo',
  216 	$< LOO UFTA | grep -q 'POS_OPT=UFTA,'
  217 	$< LOO | grep -q 'OPT_INCR=2,'
  218 	$< -ii LOO | grep -q 'OPT_INCR=4,'
  219 	$< -h | grep -- pos_arg | grep -q pos_arg_help
  220 	$< -h | grep -- pos-opt | grep -q @pos-opt-arg@
  221 	$< -h | grep -q ' \[<pos-opt>\]'
  222 endef
  223 
  224 define generic_regression_gnu_only
  225 	$< LOO --opt_arg "PoS sob" | grep -q 'OPT_S=PoS sob,'
  226 	$< --opt_arg PoS LOO | grep -q OPT_S=PoS,
  227 	$< --opt_arg="PoS sob" LOO | grep -q 'OPT_S=PoS sob,'
  228 	$< LOO -b | grep -q BOOL=on,
  229 	$< LOO --boo_l | grep -q BOOL=on,
  230 	$< LOO --boo_l --boo_l | grep -q 'POS_OPT=pos_opt_default lala,'
  231 	$< --no-boo_l LOO | grep -q BOOL=off,
  232 	$< --opt-incr -i LOO | grep -q 'OPT_INCR=4,'
  233 	$< LOO --opt-incr | grep -q 'OPT_INCR=3,'
  234 	$(REVERSE) $< LOO --opt_arg 2> /dev/null
  235 endef
  236 
  237 define _test_onlypos
  238 	$(REVERSE) grep -q case $<
  239 	$< LOO | grep -q POS_S=LOO,POS_OPT=pos-default,
  240 	$< LOO ar,guma | grep -q POS_S=LOO,POS_OPT=ar,guma,
  241 	ERROR=spurious $(REVERSE) $< one two three
  242 	ERROR='between 1 and 2' $(REVERSE) $< one two three
  243 	ERROR='Not enough' $(REVERSE) $<
  244 endef
  245 
  246 regressiontests: $(TESTDIR)/Makefile $(TESTS)
  247 
  248 $(TESTDIR)/Makefile: $(TESTDIR)/make/Makefile.m4 $(TESTDIR)/make/make.m4 $(wildcard $(TESTDIR)/make/tests/*)
  249 	autom4te -l m4sugar -I $(TESTDIR)/make $< -o $@
  250 
  251 stability: $(TESTDIR)/basic.sh $(TESTDIR)/basic2.sh
  252 	diff -q $< $(word 2,$^)
  253 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/basic.sh"
  254 basic: $(TESTDIR)/basic.sh
  255 	$(generic_regression_posix)
  256 	$(generic_regression_gnu_only)
  257 	$< -h | grep -q 'P percent: %'
  258 	$< -h | grep -q 'O percent: %'
  259 	! $< -h | grep -qe '\[--\]'
  260 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/basic.sh"
  261 basic-dash: $(TESTDIR)/basic-dash.sh
  262 	$(generic_regression_posix)
  263 	$< LOO -b | grep -q BOOL=off,
  264 	$< -h | grep -q 'P percent: %'
  265 	$< -h | grep -q 'O percent: %'
  266 	$< -h | grep -qe '\[--\]'
  267 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/basic-dash.sh"
  268 test-void: $(TESTDIR)/test-void.sh
  269 	! grep -q 'die' $<
  270 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-void.sh"
  271 call-salone: $(TESTDIR)/call-salone.sh
  272 	$(generic_regression_posix)
  273 	$(generic_regression_gnu_only)
  274 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/call-salone.sh"
  275 test-most: $(TESTDIR)/test-most.sh
  276 	$< -h | grep -q '<pos-more1-1> <pos-more1-2> \[<pos-more2-1>\] \[<pos-more2-2>\]'
  277 	$< xx yy | grep -q "POS_MORE1=xx yy,POS_MORE2=hu lu,"
  278 	$< xx yy zz aa | grep -q "POS_MORE1=xx yy,POS_MORE2=zz aa,"
  279 	$< -h | grep -q '<pos-more1-1> <pos-more1-2> \[<pos-more2-1>\] \[<pos-more2-2>\]'
  280 	$< -h | grep -q '<pos-more1>: @pos-more1-arg@'
  281 	$< -h | grep -q "<pos-more2>: @pos-more2-arg@ (defaults for <pos-more2-1> to <pos-more2-2> respectively: 'hu' and 'lu')"
  282 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-most.sh"
  283 test-more: $(TESTDIR)/test-more.sh
  284 	$< LOO x | grep -q "POS_S=LOO,POS_MORE=x f\[o\]o ba,r,"
  285 	$< LOO lul laa | grep -q "POS_S=LOO,POS_MORE=lul laa ba,r,"
  286 	$< LOO laa bus kus | grep -q "POS_S=LOO,POS_MORE=laa bus kus",
  287 	ERROR="namely: 'pos-arg' and 'pos-more'" $(REVERSE) $<
  288 	grep -q '^		_positionals' $<
  289 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-more.sh"
  290 test-onlypos: $(TESTDIR)/test-onlypos.sh
  291 	$(_test_onlypos)
  292 	! grep -q '^_arg_pos_arg=$$' $<
  293 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-onlypos.sh"
  294 test-onlypos-declared: $(TESTDIR)/test-onlypos-declared.sh
  295 	$(_test_onlypos)
  296 	grep -q '^_arg_pos_arg=$$' $<
  297 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-onlypos-declared.sh"
  298 test-onlyopt: $(TESTDIR)/test-onlyopt.sh
  299 	grep -q '^    esac$$' $<
  300 	@# ! negates the return code
  301 	! grep -q '^	' $<
  302 	$(REVERSE) grep -q POSITION $<
  303 	$< -o "PoS sob" | grep -q 'OPT_S=PoS sob,'
  304 	$< -B | grep -q 'BOOL=on'
  305 	$< -i | grep -q 'OPT_INCR=3,'
  306 	$< -i -i | grep -q 'OPT_INCR=4,'
  307 	! $< -h | grep -q -e '-B,'
  308 	$(REVERSE) $< LOO 2> /dev/null
  309 	$< --opt-arg PoS | grep -q OPT_S=PoS,
  310 	$< --opt-arg "PoS sob" | grep -q 'OPT_S=PoS sob,'
  311 	$< --boo_l | grep -q 'BOOL=on'
  312 	$< --no-boo_l | grep -q 'BOOL=off'
  313 	$< -r /usr/lib --opt-repeated /usr/local/lib | grep -q 'ARG_REPEATED=/usr/lib /usr/local/lib,'
  314 	$< -h | grep -q -e '-B|--(no-)boo_l'
  315 	$< -h | grep -q -e '-i|--incrx'
  316 	$< -h | grep -q -e '-i, --incrx'
  317 	$< -h | grep -q -e '-o|--opt-arg <arg>'
  318 	$< -h | grep -q -e '-o, --opt-arg: @opt-arg@'
  319 	$< -h | grep -q -e '-r|--opt-repeated'
  320 	$< -h | grep -q -e '-r, --opt-repeated:'
  321 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-onlyopt.sh"
  322 test-onlyopt-dash: $(TESTDIR)/test-onlyopt-dash.sh
  323 	grep -q '^    esac$$' $<
  324 	@# ! negates the return code
  325 	! grep -q '^	' $<
  326 	$(REVERSE) grep -q POSITION $<
  327 	$< -o "PoS sob" | grep -q 'OPT_S=PoS sob,'
  328 	$< -B | grep -q 'BOOL=on'
  329 	$< -i | grep -q 'OPT_INCR=3,'
  330 	$< -i -i | grep -q 'OPT_INCR=4,'
  331 	! $< -h | grep -q -e '-B,'
  332 	$(REVERSE) $< LOO 2> /dev/null
  333 	$< -h | grep -q -e '-B'
  334 	$< -h | grep -q -e '-i'
  335 	$< -h | grep -q -e '-o <arg>'
  336 	$< -h | grep -q -e '-o: @opt-arg@'
  337 	! $< -h | grep -q -e '-r'
  338 	ERROR=cosi $(REVERSE) $< -o lala cosi
  339 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-onlyopt-dash.sh"
  340 stability-salone: $(TESTDIR)/test-standalone.sh $(TESTDIR)/test-standalone2.sh
  341 	diff -q $< $(word 2,$^)
  342 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-standalone.sh"
  343 $(TESTDIR)/test-ddash.m4: $(TESTDIR)/test-ddash-old.m4 $(ARGBASH_1TO2)
  344 	$(ARGBASH_1TO2) $< -o $@
  345 
  346 test-ddash: $(TESTDIR)/test-ddash.sh
  347 	$< --boo_l | grep -q 'BOOL=on,'
  348 	$< -- --boo_l | grep -q 'BOOL=off,'
  349 	$< -- --boo_l | grep -q 'POS_OPT=--boo_l,'
  350 	$< -- --help | grep -q 'POS_OPT=--help,'
  351 	$< -- | grep -q 'POS_OPT=pos-default,'
  352 	$< -- --| grep -q 'POS_OPT=--,'
  353 	ERROR=spurious 	$(REVERSE) $< -- foo bar
  354 	ERROR=bar 	$(REVERSE) $< -- foo bar
  355 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-ddash.sh"
  356 test-simple: $(TESTDIR)/test-simple.sh
  357 	$< pos | grep -q 'OPT_S=x,POS_S=pos,'
  358 	$< -o 'uf ta' pos | grep -q 'OPT_S=uf ta,POS_S=pos,'
  359 	$< -h | grep -q 'END-$$'
  360 	$< -h | grep -q '^\s*-BEGIN'
  361 	$< -h | grep -q '^		-BEGIN'
  362 	$< -h | grep -q -v '^\s*-BEGIN2'
  363 	$< -h | grep -q -v 'END2-$$'
  364 	$< -h | grep -q '"line 2" END-\\n'
  365 	$< -h | grep -q '^		-PBEGIN'
  366 	$< -h | grep -q 'PEND-$$'
  367 	grep -q '^		esac' $<
  368 	grep -q '^			\*)' $<
  369 	ERROR=spurious 	$(REVERSE) $< -- one two
  370 	ERROR="last one was: 'two'" 	$(REVERSE) $< one two
  371 	ERROR="expect exactly 1" 	$(REVERSE) $< one two
  372 	ERROR="[Nn]ot enough" 	$(REVERSE) $<
  373 	ERROR="require exactly 1" 	$(REVERSE) $<
  374 	$< pos -o 'uf ta' | grep -q 'OPT_S=uf ta,POS_S=pos,'
  375 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-simple.sh"
  376 test-simple-dash: $(TESTDIR)/test-simple-dash.sh
  377 	$< pos | grep -q 'OPT_S=x,POS_S=pos,'
  378 	$< -o 'uf ta' pos | grep -q 'OPT_S=uf ta,POS_S=pos,'
  379 	$< -h | grep -q 'END-$$'
  380 	$< -h | grep -q '^\s*-BEGIN'
  381 	$< -h | grep -q '^		-BEGIN'
  382 	$< -h | grep -q -v '^\s*-BEGIN2'
  383 	$< -h | grep -q -v 'END2-$$'
  384 	$< -h | grep -q '"line 2" END-\\n'
  385 	$< -h | grep -q '^		-PBEGIN'
  386 	$< -h | grep -q 'PEND-$$'
  387 	grep -q '^		esac' $<
  388 	grep -q '^			\*)' $<
  389 	ERROR=spurious 	$(REVERSE) $< -- one two
  390 	ERROR="last one was: 'two'" 	$(REVERSE) $< one two
  391 	ERROR="expect exactly 1" 	$(REVERSE) $< one two
  392 	ERROR="[Nn]ot enough" 	$(REVERSE) $<
  393 	ERROR="require exactly 1" 	$(REVERSE) $<
  394 	ERROR="got 3" $(REVERSE) $< -- -o 'uf ta' pos
  395 	ERROR="got 3" $(REVERSE) $< pos -o 'uf ta'
  396 	ERROR="last one was: 'uf ta'" $(REVERSE) $< pos -o 'uf ta'
  397 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-simple-dash.sh"
  398 test-diy-noop: $(TESTDIR)/test-diy-noop.sh
  399 	$< LOO --opt_arg > /dev/null
  400 	$< LOO 1 2 3 3 > /dev/null
  401 	$< > /dev/null
  402 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-diy-noop.sh"
  403 $(TESTDIR)/test-diy-noop.m4: $(TESTDIR)/basic.m4
  404 	sed -e 's/ARGBASH_GO/ARGBASH_PREPARE/' $< > $@
  405 
  406 $(TESTDIR)/test-diy-noop.sh: $(TESTDIR)/test-diy-noop.m4
  407 	$(ARGBASH_BIN) -c -o "$@" "$<"
  408 
  409 test-diy: $(TESTDIR)/test-diy.sh
  410 	$(generic_regression_posix)
  411 	$(generic_regression_gnu_only)
  412 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-diy.sh"
  413 $(TESTDIR)/test-diy.m4: $(TESTDIR)/test-diy-noop.m4 $(TESTDIR)/test-diy-noop.sh
  414 	sed -e "s/#.*\[$$/&\n$$(grep -e '#  \S' "$(TESTDIR)/test-diy-noop.sh" | sed -e 's/^#  //' | tr '\n' ';')/" $< > $@
  415 
  416 test-wrapping-second_level: $(TESTDIR)/test-wrapping-second_level.sh
  417 	$< -h | grep -q opt-arg
  418 	$< -h | grep -q pos-arg
  419 	@# ! negates the return code
  420 	! $< -h | grep -q boo_l
  421 	@# no spaces as indentation (that test-onlyopt uses)
  422 	! grep -q '^  ' $<
  423 	grep -q '^		esac' $<
  424 	$< XX LOOL | grep -q 'POS_S0=XX,POS_S=LOOL,POS_OPT=pos-default'
  425 	$< XX LOOL | grep -q 'POS_S=LOOL,POS_OPT=pos-default'
  426 	$< XX LOOL --opt-arg lalala | grep -q OPT_S=lalala,
  427 	$< XX LOOL --opt-arg lalala | grep -q 'CMDLINE=--opt-arg lalala XX LOOL pos-default,'
  428 	$< XX LOOL --opt-repeated w -r x --opt-repeated=y -rz | grep -q 'CMDLINE=--opt-repeated w -r x --opt-repeated=y -rz XX LOOL pos-default,'
  429 	$< XX LOOL | grep -q 'POS_S1=,'
  430 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-wrapping-second_level.sh"
  431 $(TESTDIR)/test-wrapping-second_level.sh: $(TESTDIR)/test-wrapping-second_level.m4 $(TESTDIR)/test-wrapping-single_level.sh $(TESTDIR)/test-onlyopt.m4 $(ARGBASH_BIN)
  432 	$(ARGBASH_EXEC) $< -o $@
  433 
  434 $(TESTDIR)/test-wrapping-single_level.sh: $(TESTDIR)/test-wrapping-single_level.m4 $(TESTDIR)/test-onlypos.m4 $(ARGBASH_BIN)
  435 	$(ARGBASH_EXEC) $< -o $@
  436 
  437 test-wrapping: $(TESTDIR)/test-wrapping.sh $(TESTDIR)/test-onlyopt.m4 $(TESTDIR)/test-onlypos.m4
  438 	$< -h | grep -q opt-arg
  439 	$< -h | grep -q pos-arg
  440 	@# ! negates the return code
  441 	! $< -h | grep -q boo_l
  442 	@# no spaces as indentation (that test-onlyopt uses)
  443 	! grep -q '^  ' $<
  444 	grep -q '^		esac' $<
  445 	$< XX LOOL | grep -q 'POS_S0=XX,POS_S=LOOL,POS_OPT=pos-default'
  446 	$< XX LOOL | grep -q 'POS_S=LOOL,POS_OPT=pos-default'
  447 	$< XX LOOL --opt-arg lalala | grep -q OPT_S=lalala,
  448 	$< XX LOOL --opt-arg lalala | grep -q 'CMDLINE=--opt-arg lalala LOOL pos-default,'
  449 	$< XX LOOL --opt-repeated w -r x --opt-repeated=y -rz | grep -q 'CMDLINE=--opt-repeated w -r x --opt-repeated=y -rz LOOL pos-default,'
  450 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-wrapping.sh"
  451 $(TESTDIR)/test-wrapping-otherdir.sh: $(TESTDIR)/test-wrapping-otherdir.m4 $(TESTDIR)/otherdir/test-onlyopt.m4 $(TESTDIR)/otherdir/test-onlypos.m4 $(ARGBASH_BIN) $(ARGBASH_BIN)
  452 	$(ARGBASH_EXEC) $< -o $@
  453 
  454 test-wrapping-otherdir: $(TESTDIR)/test-wrapping-otherdir.sh
  455 	$< -h | grep -q opt-arg
  456 	$< -h | grep -q pos-arg
  457 	@# ! negates the return code
  458 	! $< -h | grep -q boo_l
  459 	@# no spaces as indentation (that test-onlyopt uses)
  460 	! grep -q '^  ' $<
  461 	grep -q '^		esac' $<
  462 	$< XX LOOL | grep -q 'POS_S0=XX,POS_S=LOOL,POS_OPT=pos-default'
  463 	$< XX LOOL | grep -q 'POS_S=LOOL,POS_OPT=pos-default'
  464 	$< XX LOOL --opt-arg lalala | grep -q OPT_S=lalala,
  465 	$< XX LOOL --opt-arg lalala | grep -q 'CMDLINE=--opt-arg lalala LOOL pos-default,'
  466 	$< XX LOOL --opt-repeated w -r x --opt-repeated=y -rz | grep -q 'CMDLINE=--opt-repeated w -r x --opt-repeated=y -rz LOOL pos-default,'
  467 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-wrapping-otherdir.sh"
  468 $(TESTDIR)/otherdir/test-onlyopt.m4: $(TESTDIR)/test-onlyopt.m4
  469 	mkdir -p $(TESTDIR)/otherdir && cp $< $@
  470 
  471 $(TESTDIR)/otherdir/test-onlypos.m4: $(TESTDIR)/test-onlypos.m4
  472 	mkdir -p $(TESTDIR)/otherdir && cp $< $@
  473 
  474 test-wrapping-more: $(TESTDIR)/test-wrapping-more.sh $(TESTDIR)/test-onlyopt.m4
  475 	$< -i -i -i | grep -q 'CMDLINE=-i -i -i,'
  476 	$< -i -i | grep -q 'OPT_INCR=4,'
  477 	ERROR="nexpected argument '--opt-arg'" $(REVERSE) $< --opt-arg lalala
  478 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-wrapping-more.sh"
  479 test-wrapping-excl: $(TESTDIR)/test-wrapping-excl.sh $(TESTDIR)/test-onlypos.m4
  480 	$(_test_onlypos)
  481 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-wrapping-excl.sh"
  482 stability-wrapping: $(TESTDIR)/test-wrapping.sh $(TESTDIR)/test-wrapping2.sh
  483 	diff -q $< $(word 2,$^)
  484 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-wrapping.sh"
  485 test-infinity-minimal_call: $(TESTDIR)/test-infinity-minimal_call.sh
  486 	$< | grep -q 'POS_S='
  487 	$< 1 | grep -q 'POS_S=1,'
  488 	$< 1 2 "3 1 4" 4 5 | grep -q 'POS_S=1,2,3 1 4,4,5,'
  489 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-infinity-minimal_call.sh"
  490 test-progs: $(TESTDIR)/test-progs.sh
  491 	$< -h | grep MAKE | grep -q utility
  492 	$< -h | grep FULALA | grep -q BOOM
  493 	ERROR="fulala doesnt exist" $(REVERSE) $<
  494 	$< 2>&1 | grep fulala | grep -q exist
  495 	FULALA=make $<
  496 	ERROR="make doesnt work" MAKE=false FULALA=make $(REVERSE) $<
  497 	$< -h | grep fulala | grep -q FULALA
  498 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-progs.sh"
  499 test-prog: $(TESTDIR)/test-prog.sh
  500 	$< -h | grep FULALA | grep -q BOOM
  501 	ERROR="fulala doesnt exist" $(REVERSE) $<
  502 	$< 2>&1 | grep fulala | grep -q exist
  503 	FULALA=make $<
  504 	$< -h | grep fulala | grep -q FULALA
  505 	ERROR="fulala doesnt work" FULALA=false $(REVERSE) $<
  506 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-prog.sh"
  507 test-infinity: $(TESTDIR)/test-infinity.sh
  508 	$< | grep -q 'POS_S=first,second,third,'
  509 	$< 1 | grep -q 'POS_S=1,second,third,'
  510 	$< 1 2 "3 1 4" 4 5 | grep -q 'POS_S=1,2,3 1 4,4,5,'
  511 	! grep -q handle_passed_args_count $<
  512 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-infinity.sh"
  513 test-infinity-nodefaults: $(TESTDIR)/test-infinity-nodefaults.sh
  514 	ERROR="require at least 2" $(REVERSE) $<
  515 	ERROR="namely: 'pos-arg' (2 times)" $(REVERSE) $<
  516 	$< 1 "2 3" | grep -q 'POS_S=1,2 3'
  517 	$< 1 2 "3 1 4" 4 5 | grep -q 'POS_S=1,2,3 1 4,4,5,'
  518 	grep -q handle_passed_args_count $<
  519 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-infinity-nodefaults.sh"
  520 test-infinity-mixed: $(TESTDIR)/test-infinity-mixed.sh
  521 	$< -h | grep -q '<pos-arg-1> \[<pos-arg-2>\] \.\.\. \[<pos-arg-n>\] \.\.\.$$'
  522 	ERROR="require at least 1" $(REVERSE) $<
  523 	$< 1 | grep -q 'POS_S=1,first,second'
  524 	$< 1 2 "3 1 4" 4 5 | grep -q 'POS_S=1,2,3 1 4,4,5,'
  525 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-infinity-mixed.sh"
  526 test-leftovers: $(TESTDIR)/test-leftovers.sh
  527 	$< -? | grep -q '\[-c|--cosi <arg>\] \[--(no-)fear\] \[-m|--more\] \[-?|--hilfe\] <another> \.\.\. $$'
  528 	$< -c ours -m --more --more --no-fear "ours pos" left "o ver" | grep -q 'MORE=3,OPT_S=ours,FEAR=off,POS_S=ours pos,LEFTOVERS=left,o ver,'
  529 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-leftovers.sh"
  530 gen-test-infinity-dash: $(TESTDIR)/gen-test-infinity.m4 $(ARGBASH_BIN)
  531 	ERROR="supported" $(REVERSE) $(ARGBASH_EXEC) --type posix-script $< > /dev/null
  532 	ERROR="infinite" $(REVERSE) $(ARGBASH_EXEC) --type posix-script $< > /dev/null
  533 
  534 gen-test-wrap-dash: $(TESTDIR)/gen-test-wrap.m4 $(ARGBASH_BIN)
  535 	ERROR="supported" $(REVERSE) $(ARGBASH_EXEC) --type posix-script $< > /dev/null
  536 
  537 gen-test-pos: $(TESTDIR)/gen-test-pos.m4 $(ARGBASH_BIN)
  538 	ERROR="pos-arg" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  539 
  540 gen-test-opt: $(TESTDIR)/gen-test-opt.m4 $(ARGBASH_BIN)
  541 	ERROR="opt-arg" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  542 
  543 gen-test-pos2: $(TESTDIR)/gen-test-pos2.m4 $(ARGBASH_BIN)
  544 	ERROR="pos_arg" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  545 
  546 gen-test-opt2: $(TESTDIR)/gen-test-opt2.m4 $(ARGBASH_BIN)
  547 	ERROR="opt_arg" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  548 
  549 gen-test-infinity-illegal: $(TESTDIR)/gen-test-infinity-illegal.m4 $(ARGBASH_BIN)
  550 	ERROR="number of expected positional arguments before 'pos-arg' is unknown (because of argument 'pos-arg', which has a default)" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  551 
  552 gen-test-bool-default: $(TESTDIR)/gen-test-bool-default.m4 $(ARGBASH_BIN)
  553 	ERROR="'on' or 'off' are allowed as boolean defaults" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  554 
  555 gen-test-pos-opt: $(TESTDIR)/gen-test-pos-opt.m4 $(ARGBASH_BIN)
  556 	ERROR="same-arg" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  557 
  558 gen-test-pos-opt2: $(TESTDIR)/gen-test-pos-opt2.m4 $(ARGBASH_BIN)
  559 	ERROR="same_arg" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  560 
  561 gen-test-more: $(TESTDIR)/gen-test-more.m4 $(ARGBASH_BIN)
  562 	ERROR="is unknown" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  563 
  564 gen-test-illegal-pos: $(TESTDIR)/gen-test-illegal-pos.m4 $(ARGBASH_BIN)
  565 	ERROR="contains forbidden characters" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  566 
  567 gen-test-illegal-opt: $(TESTDIR)/gen-test-illegal-opt.m4 $(ARGBASH_BIN)
  568 	ERROR="one character" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  569 
  570 gen-test-misspelled: $(TESTDIR)/gen-test-misspelled.m4 $(ARGBASH_BIN)
  571 	ERROR="ARG_FOOBAR" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  572 	ERROR="ARGBASH_GOO" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  573 
  574 gen-test-unmatched_bracket: $(TESTDIR)/gen-test-unmatched_bracket.m4 $(ARGBASH_BIN)
  575 	ERROR="unmatched square bracket on line 3" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  576 	ERROR="# ARG_OPTIONAL_BOOLEAN(\[long\], l, \[)" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  577 
  578 gen-test-badcall-multi: $(TESTDIR)/gen-test-badcall-multi.m4 $(ARGBASH_BIN)
  579 	ERROR="3rd argument" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  580 	ERROR="num of args" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  581 	ERROR="actual number of" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  582 
  583 basic-docopt: $(TESTDIR)/basic.txt
  584 	grep -q "\[<pos-opt>\]" $<
  585 	grep -q "\[--opt_arg OPT_ARG\]" $<
  586 	grep -q "\s-o OPT_ARG, --opt_arg OPT_ARG\s" $<
  587 	! test -x $<
  588 
  589 test-onlyopt-docopt: $(TESTDIR)/test-onlyopt.txt
  590 	grep -q "\[--opt-repeated OPT-REPEATED\]\.\.\." $<
  591 	grep -q "\[--incrx\]\.\.\." $<
  592 
  593 test-delim-space: $(TESTDIR)/test-delim-space.sh
  594 	ERROR="unexpected argument '--opt=something'" $(REVERSE) $< --opt=something
  595 	$< --opt something | grep -q 'OPT_S=something,'
  596 	ERROR="unexpected argument '--add=three'" $(REVERSE) $< -a one --add two --add=three
  597 	$< -a one --add two | grep -q 'OPT_REP=one two,'
  598 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-delim-space.sh"
  599 test-delim-equals: $(TESTDIR)/test-delim-equals.sh
  600 	ERROR="unexpected argument '--opt'" $(REVERSE) $< --opt something
  601 	$< --opt=something | grep -q 'OPT_S=something,'
  602 	$< --xxx | grep -q 'XXX=on,'
  603 	ERROR="unexpected argument '--add'" $(REVERSE) $< -a one --add two --add=three
  604 	$< -a one --add=two | grep -q 'OPT_REP=one two,'
  605 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-delim-equals.sh"
  606 test-delim-both: $(TESTDIR)/test-delim-both.sh
  607 	$< --opt something | grep -q 'OPT_S=something,'
  608 	$< --opt=something | grep -q 'OPT_S=something,'
  609 	$< -a one --add two --add=three | grep -q 'OPT_REP=one two three'
  610 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-delim-both.sh"
  611 test-init_simple: $(TESTDIR)/test-init_simple.sh
  612 	ERROR="[Nn]ot enough" $(REVERSE) $<
  613 	$< foo | grep -q "'pos': foo"
  614 	$< foo --opt bar | grep -q " --opt: bar"
  615 	$< foo --opt bar | grep -q "'boo' is off"
  616 	$< foo --opt bar --opt2 baz | grep -q " --opt: bar"
  617 	$< foo --opt bar --opt2 baz | grep -q " --opt2: baz"
  618 	$< foo --opt bar --opt2 baz --boo | grep -q "'boo' is on"
  619 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-init_simple.sh"
  620 test-init_simple-s: $(TESTDIR)/test-init_simple-s.sh
  621 	ERROR="[Nn]ot enough" $(REVERSE) $<
  622 	$< foo | grep -q "'pos': foo"
  623 	$< foo --opt bar | grep -q " --opt: bar"
  624 	$< foo --opt bar | grep -q "'boo' is off"
  625 	$< foo --opt bar --opt2 baz | grep -q " --opt: bar"
  626 	$< foo --opt bar --opt2 baz | grep -q " --opt2: baz"
  627 	$< foo --opt bar --opt2 baz --boo | grep -q "'boo' is on"
  628 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-init_simple-s.sh"
  629 test-init_simple-ss: $(TESTDIR)/test-init_simple-ss.sh $(TESTDIR)/test-init_simple-ss-parsing.sh
  630 	ERROR="[Nn]ot enough" $(REVERSE) $<
  631 	$< foo | grep -q "'pos': foo"
  632 	$< foo --opt bar | grep -q " --opt: bar"
  633 	$< foo --opt bar | grep -q "'boo' is off"
  634 	$< foo --opt bar --opt2 baz | grep -q " --opt: bar"
  635 	$< foo --opt bar --opt2 baz | grep -q " --opt2: baz"
  636 	$< foo --opt bar --opt2 baz --boo | grep -q "'boo' is on"
  637 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-init_simple-ss.sh"
  638 $(TESTDIR)/test-init_simple.m4: $(ARGBASH_INIT)
  639 	$(ARGBASH_INIT_EXEC) --pos pos --opt opt2 --opt opt --opt-bool boo $@
  640 
  641 $(TESTDIR)/test-init_simple-s.m4: $(ARGBASH_INIT)
  642 	$(ARGBASH_INIT_EXEC) --pos pos --opt opt2 --opt opt --opt-bool boo -s $@
  643 	sed -i '2 s|^|# shellcheck source=$(basename $@)-parsing.sh\n|' $@
  644 
  645 $(TESTDIR)/regenerate-test-init_simple-s-update.m4:
  646 	touch $@
  647 
  648 $(TESTDIR)/test-init_simple-s-update.m4: $(ARGBASH_INIT) $(TESTDIR)/regenerate-test-init_simple-s-update.m4
  649 	$(ARGBASH_INIT_EXEC) --opt ordnung -s $@ > /dev/null
  650 	sed -i '2 s|^|# shellcheck source=$(basename $@)-parsing.sh\n|' $@
  651 	sed -i 's/^echo .*//' $@
  652 	echo 'test "$$_arg_ordnung" = yes || exit 1' >> $@
  653 
  654 test-init_simple-s-update: $(TESTDIR)/test-init_simple-s-update.sh
  655 	@# Regenerate everyting during the next test run
  656 	touch $(TESTDIR)/regenerate-test-init_simple-s-update.m4
  657 	$< --ordnung yes > /dev/null
  658 	$(REVERSE) $< > /dev/null
  659 	ERROR="unexpected argument" $(REVERSE) $< -o yes > /dev/null
  660 	sed -i 's/\[ordnung\]/&,[o]/' $(TESTDIR)/test-init_simple-s-update-parsing.sh
  661 	$(ARGBASH_BIN) $< > /dev/null
  662 	$< --ordnung yes > /dev/null
  663 	$(REVERSE) $< > /dev/null
  664 	$< -o yes > /dev/null
  665 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-init_simple-s-update.sh"
  666 $(TESTDIR)/test-init_simple-ss.sh: $(ARGBASH_INIT)
  667 	$(ARGBASH_INIT_EXEC) --pos pos --opt opt2 --opt opt --opt-bool boo -s -s $@
  668 	sed -i '2 s|^|# shellcheck source=$(basename $@)-parsing.sh\n|' $@
  669 
  670 $(TESTDIR)/test-init_simple-ss-parsing.m4: $(TESTDIR)/test-init_simple-ss.sh
  671 	@
  672 
  673 $(TESTDIR)/gen-test-init_name_char.m4: $(ARGBASH_INIT)
  674 	$(ARGBASH_INIT_EXEC) --opt-bool foo/bar-baz $@
  675 
  676 $(TESTDIR)/gen-test-init_name_dash.m4: $(ARGBASH_INIT)
  677 	$(ARGBASH_INIT_EXEC) --pos -bool $@
  678 
  679 gen-test-init_name_dash: $(TESTDIR)/gen-test-init_name_dash.m4 $(ARGBASH_BIN)
  680 	ERROR="'-bool' .* begins with a dash" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  681 
  682 gen-test-init_name_char: $(TESTDIR)/gen-test-init_name_char.m4 $(ARGBASH_BIN)
  683 	ERROR="'foo/bar-baz' .* contains forbidden characters" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  684 
  685 test-env-base: $(TESTDIR)/test-env-base.sh
  686 	$< | grep -q 'ENVI_FOO=def,ault,'
  687 	$< | grep -q 'ENVI_BAR=,'
  688 	ENVI_FOO=something $< | grep -q 'ENVI_FOO=something'
  689 	$< -h | grep -q "ENVI_FOO: A sample env, variable. (default: 'def,ault')"
  690 	$< -h | grep -q "ENVI_BAR: A sample env, variable."
  691 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-env-base.sh"
  692 test-env-simple: $(TESTDIR)/test-env-simple.sh
  693 	$< | grep -q 'ENVI_FOO=def,ault,'
  694 	! $< -h | grep -q 'ENVI_FOO'
  695 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-env-simple.sh"
  696 test-int: $(TESTDIR)/test-int.sh
  697 	$< 1 | grep -q "POS_S=1,"
  698 	ERROR="integer" $(REVERSE) $< a
  699 	ERROR="integer" $(REVERSE) $< 1.5
  700 	$< 1 --int 2 | grep -q "OPT_S=2,"
  701 	ERROR="integer" $(REVERSE) $< 1 --int b
  702 	$< 01 | grep -q "POS_S=1,"
  703 	$< +1 | grep -q "POS_S=1,"
  704 	$< -1 | grep -q "POS_S=-1,"
  705 	$< -1776 | grep -q "POS_S=-1776,"
  706 	$< -h | grep -q "INT"
  707 	$< -h | grep -q "INT+0"
  708 	$< -h | grep -q "INT+"
  709 	$< 1 --nnint 2 | grep -q "NN=2,"
  710 	$< 1 --pint 2 | grep -q "P=2,"
  711 	ERROR="positive" $(REVERSE) $< 1 --pint 0
  712 	ERROR="negative" $(REVERSE) $< 1 --nnint -1
  713 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-int.sh"
  714 test-group: $(TESTDIR)/test-group.sh
  715 	$< foo | grep -q "ACT=foo"
  716 	$< '' | grep -q "ACT="
  717 	$< foo,baz | grep -q "ACT=foo,baz,"
  718 	$< "bar bar" | grep -q "ACT=bar bar,"
  719 	ERROR="allowed" $(REVERSE) $< fuuuu
  720 	ERROR="allowed" $(REVERSE) $< bar
  721 	@# Assure that there is not the string '_idx' in the script since we don't want indices support in this test
  722 	! grep -q _idx $<
  723 	$< -h | grep act-ion | grep -q "'foo,baz'"
  724 	$< -h | grep act-ion | grep -q "'bar bar'"
  725 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-group.sh"
  726 test-group-idx: $(TESTDIR)/test-group-idx.sh
  727 	$< foo | grep -q "ACT=foo,IDX=0,"
  728 	$< foo,baz | grep -q "ACT=foo,baz,IDX=3,"
  729 	$< "bar bar" | grep -q "ACT=bar bar,IDX=2,"
  730 	ERROR="allowed" $(REVERSE) $< "bar bar" --repeated bar
  731 	! $< "bar bar" --repeated "bar bar" | grep -q "IDX3=2," > /dev/null
  732 	$< "bar bar" --opt-tion "bar bar" | grep -q "IDX2=2," > /dev/null
  733 	ERROR="allowed" $(REVERSE) $< fuuuu
  734 	ERROR="allowed" $(REVERSE) $< bar
  735 	# $< -h | grep action | grep ACTION | grep -q 'foo,baz'
  736 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-group-idx.sh"
  737 $(TESTDIR)/gen-test-group-wrong.m4: $(TESTDIR)/test-group.m4
  738 	sed -e 's/repeated],/foo,&/' $< > $@
  739 
  740 gen-test-group-wrong: $(TESTDIR)/gen-test-group-wrong.m4 $(ARGBASH_BIN)
  741 	ERROR="'foo' is not a script argument" $(REVERSE) $(ARGBASH_EXEC) $< > /dev/null
  742 
  743 $(TESTDIR)/test-semi_strict.sh: $(TESTDIR)/test-simple.m4 $(ARGBASH_BIN)
  744 	printf "%s\n%s\n" "#!/bin/bash" "# ARG_RESTRICT_VALUES([no-local-options])" | cat - $< | $(ARGBASH_BIN) -o $(@) -
  745 $(TESTDIR)/test-very_strict.sh: $(TESTDIR)/test-simple.m4 $(ARGBASH_BIN)
  746 	printf "%s\n%s\n" "#!/bin/bash" "# ARG_RESTRICT_VALUES([no-any-options])" | cat - $< | $(ARGBASH_BIN) -o $(@) -
  747 test-semi_strict: $(TESTDIR)/test-semi_strict.sh
  748 	$< -o -x pos-arg | grep -q 'OPT_S=-x,'
  749 	$< -o --opt-argx pos-arg | grep -q 'OPT_S=--opt-argx,'
  750 	ERROR="omitted the actual value" $(REVERSE) $< -o -o pos-arg
  751 	ERROR="omitted the actual value" $(REVERSE) $< -o -ofoo pos-arg
  752 	ERROR="omitted the actual value" $(REVERSE) $< -o --prefix
  753 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-semi_strict.sh"
  754 test-very_strict: $(TESTDIR)/test-very_strict.sh
  755 	ERROR="are trying to pass an option" $(REVERSE) $< -o -x pos-arg
  756 	ERROR="are trying to pass an option" $(REVERSE) $< -o -o pos-arg
  757 	ERROR="are trying to pass an option" $(REVERSE) $< -x
  758 	ERROR="are trying to pass an option" $(REVERSE) $< --foobar
  759 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-very_strict.sh"
  760 $(TESTDIR)/test-getopt-equals.sh: $(TESTDIR)/test-onlyopt.m4 $(ARGBASH_BIN)
  761 	printf "%s\n%s\n%s\n" "#!/bin/bash" "# ARGBASH_SET_DELIM([=])" "# ARG_OPTION_STACKING([getopt])" | cat - $< | $(ARGBASH_BIN) -o $(@) -
  762 $(TESTDIR)/test-getopt-both.sh: $(TESTDIR)/test-onlyopt.m4 $(ARGBASH_BIN)
  763 	printf "%s\n%s\n%s\n" "#!/bin/bash" "# ARGBASH_SET_DELIM([ =])" "# ARG_OPTION_STACKING([getopt])" | cat - $< | $(ARGBASH_BIN) -o $(@) -
  764 $(TESTDIR)/test-getopt-space.sh: $(TESTDIR)/test-onlyopt.m4 $(ARGBASH_BIN)
  765 	printf "%s\n%s\n%s\n" "#!/bin/bash" "# ARGBASH_SET_DELIM([ ])" "# ARG_OPTION_STACKING([getopt])" | cat - $< | $(ARGBASH_BIN) -o $(@) -
  766 test-getopt-both: $(TESTDIR)/test-getopt-both.sh
  767 	$< -ii | grep -q 'OPT_INCR=4,'
  768 	$< --incrx -ii | grep -q 'OPT_INCR=5,'
  769 	$< -Bi | grep 'OPT_INCR=3,' | grep -q 'BOOL=on,'
  770 	$< -Bio bu | grep 'OPT_INCR=3,' | grep 'BOOL=on,' | grep -q 'OPT_S=bu,'
  771 	$< -Biobu | grep 'OPT_INCR=3,' | grep 'BOOL=on,' | grep -q 'OPT_S=bu,'
  772 	$< -Boibu | grep 'BOOL=on,' | grep 'OPT_INCR=2,' | grep -q 'OPT_S=ibu,'
  773 	ERROR="'-Bfoo' can't be decomposed to -B and -foo, because -B doesn't accept value and '-f' doesn't correspond to a short option" $(REVERSE) $< -Bfoo
  774 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-getopt-both.sh"
  775 test-getopt-space: $(TESTDIR)/test-getopt-space.sh
  776 	$< -ii | grep -q 'OPT_INCR=4,'
  777 	$< --incrx -ii | grep -q 'OPT_INCR=5,'
  778 	$< -Bi | grep 'OPT_INCR=3,' | grep -q 'BOOL=on,'
  779 	$< -Bio bu | grep 'OPT_INCR=3,' | grep 'BOOL=on,' | grep -q 'OPT_S=bu,'
  780 	$< -Biobu | grep 'OPT_INCR=3,' | grep 'BOOL=on,' | grep -q 'OPT_S=bu,'
  781 	$< -Boibu | grep 'BOOL=on,' | grep 'OPT_INCR=2,' | grep -q 'OPT_S=ibu,'
  782 	ERROR="'-Bfoo' can't be decomposed to -B and -foo, because -B doesn't accept value and '-f' doesn't correspond to a short option" $(REVERSE) $< -Bfoo
  783 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-getopt-space.sh"
  784 test-getopt-equals: $(TESTDIR)/test-getopt-equals.sh
  785 	$< -ii | grep -q 'OPT_INCR=4,'
  786 	$< --incrx -ii | grep -q 'OPT_INCR=5,'
  787 	$< -Bi | grep 'OPT_INCR=3,' | grep -q 'BOOL=on,'
  788 	$< -Bio bu | grep 'OPT_INCR=3,' | grep 'BOOL=on,' | grep -q 'OPT_S=bu,'
  789 	$< -Biobu | grep 'OPT_INCR=3,' | grep 'BOOL=on,' | grep -q 'OPT_S=bu,'
  790 	$< -Boibu | grep 'BOOL=on,' | grep 'OPT_INCR=2,' | grep -q 'OPT_S=ibu,'
  791 	ERROR="'-Bfoo' can't be decomposed to -B and -foo, because -B doesn't accept value and '-f' doesn't correspond to a short option" $(REVERSE) $< -Bfoo
  792 	test -z "$(SHELLCHECK)" || $(SHELLCHECK) "$(TESTDIR)/test-getopt-equals.sh"
  793 tests-gen: $(TESTS_GEN)
  794 
  795 tests-clean:
  796 	$(RM) $(SCRIPTS)
  797 	rmdir $(TESTDIR)/otherdir
  798 
  799 .PHONY: $(PHONIES)