Home | History | Annotate | Line # | Download | only in sh
t_expand.sh revision 1.10
      1  1.10       kre # $NetBSD: t_expand.sh,v 1.10 2017/03/19 20:29:30 kre Exp $
      2   1.1    jruoho #
      3   1.1    jruoho # Copyright (c) 2007, 2009 The NetBSD Foundation, Inc.
      4   1.1    jruoho # All rights reserved.
      5   1.1    jruoho #
      6   1.1    jruoho # Redistribution and use in source and binary forms, with or without
      7   1.1    jruoho # modification, are permitted provided that the following conditions
      8   1.1    jruoho # are met:
      9   1.1    jruoho # 1. Redistributions of source code must retain the above copyright
     10   1.1    jruoho #    notice, this list of conditions and the following disclaimer.
     11   1.1    jruoho # 2. Redistributions in binary form must reproduce the above copyright
     12   1.1    jruoho #    notice, this list of conditions and the following disclaimer in the
     13   1.1    jruoho #    documentation and/or other materials provided with the distribution.
     14   1.1    jruoho #
     15   1.1    jruoho # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     16   1.1    jruoho # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     17   1.1    jruoho # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     18   1.1    jruoho # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     19   1.1    jruoho # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     20   1.1    jruoho # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     21   1.1    jruoho # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     22   1.1    jruoho # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     23   1.1    jruoho # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     24   1.1    jruoho # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     25   1.1    jruoho # POSSIBILITY OF SUCH DAMAGE.
     26   1.1    jruoho #
     27   1.6  christos # the implementation of "sh" to test
     28   1.6  christos : ${TEST_SH:="/bin/sh"}
     29   1.1    jruoho 
     30   1.1    jruoho #
     31   1.1    jruoho # This file tests the functions in expand.c.
     32   1.1    jruoho #
     33   1.1    jruoho 
     34   1.1    jruoho delim_argv() {
     35   1.1    jruoho 	str=
     36   1.1    jruoho 	while [ $# -gt 0 ]; do
     37   1.1    jruoho 		if [ -z "${str}" ]; then
     38   1.1    jruoho 			str=">$1<"
     39   1.1    jruoho 		else
     40   1.1    jruoho 			str="${str} >$1<"
     41   1.1    jruoho 		fi
     42   1.2       ast 		shift
     43   1.1    jruoho 	done
     44   1.1    jruoho 	echo ${str}
     45   1.1    jruoho }
     46   1.1    jruoho 
     47   1.1    jruoho atf_test_case dollar_at
     48   1.1    jruoho dollar_at_head() {
     49   1.1    jruoho 	atf_set "descr" "Somewhere between 2.0.2 and 3.0 the expansion" \
     50   1.1    jruoho 	                "of the \$@ variable had been broken.  Check for" \
     51   1.1    jruoho 			"this behavior."
     52   1.1    jruoho }
     53   1.1    jruoho dollar_at_body() {
     54   1.1    jruoho 	# This one should work everywhere.
     55   1.6  christos 	atf_check -s exit:0 -o inline:' EOL\n' -e empty \
     56   1.6  christos 		${TEST_SH} -c 'echo "" "" | '" sed 's,\$,EOL,'"
     57   1.1    jruoho 
     58   1.1    jruoho 	# This code triggered the bug.
     59   1.6  christos 	atf_check -s exit:0 -o inline:' EOL\n' -e empty \
     60   1.6  christos 		${TEST_SH} -c 'set -- "" ""; echo "$@" | '" sed 's,\$,EOL,'"
     61   1.6  christos 
     62   1.6  christos 	atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \
     63   1.6  christos 		'set -- -; shift; n_arg() { echo $#; }; n_arg "$@"'
     64   1.1    jruoho }
     65   1.1    jruoho 
     66   1.1    jruoho atf_test_case dollar_at_with_text
     67   1.1    jruoho dollar_at_with_text_head() {
     68   1.1    jruoho 	atf_set "descr" "Test \$@ expansion when it is surrounded by text" \
     69   1.1    jruoho 	                "within the quotes.  PR bin/33956."
     70   1.1    jruoho }
     71   1.1    jruoho dollar_at_with_text_body() {
     72   1.6  christos 
     73   1.6  christos 	cat <<'EOF' > h-f1
     74   1.6  christos 
     75   1.6  christos delim_argv() {
     76   1.6  christos 	str=
     77   1.6  christos 	while [ $# -gt 0 ]; do
     78   1.6  christos 		if [ -z "${str}" ]; then
     79   1.6  christos 			str=">$1<"
     80   1.6  christos 		else
     81   1.6  christos 			str="${str} >$1<"
     82   1.6  christos 		fi
     83   1.6  christos 		shift
     84   1.6  christos 	done
     85   1.6  christos 	echo "${str}"
     86   1.6  christos }
     87   1.6  christos 
     88   1.6  christos EOF
     89   1.6  christos 	cat <<'EOF' > h-f2
     90   1.6  christos 
     91   1.6  christos delim_argv() {
     92   1.6  christos 	str=
     93   1.6  christos 	while [ $# -gt 0 ]; do
     94   1.6  christos 
     95   1.6  christos 		str="${str}${str:+ }>$1<"
     96   1.6  christos 		shift
     97   1.6  christos 
     98   1.6  christos 	done
     99   1.6  christos 	echo "${str}"
    100   1.6  christos }
    101   1.6  christos 
    102   1.6  christos EOF
    103   1.6  christos 
    104   1.6  christos 	chmod +x h-f1 h-f2
    105   1.6  christos 
    106   1.6  christos 	for f in 1 2
    107   1.6  christos 	do
    108   1.6  christos 		atf_check -s exit:0 -o inline:'\n' -e empty ${TEST_SH} -c \
    109   1.6  christos 			". ./h-f${f}; "'set -- ; delim_argv "$@"'
    110   1.6  christos 		atf_check -s exit:0 -o inline:'>foobar<\n' -e empty \
    111   1.6  christos 			${TEST_SH} -c \
    112   1.6  christos 			". ./h-f${f}; "'set -- ; delim_argv "foo$@bar"'
    113   1.6  christos 		atf_check -s exit:0 -o inline:'>foo  bar<\n' -e empty \
    114   1.6  christos 			${TEST_SH} -c \
    115   1.6  christos 			". ./h-f${f}; "'set -- ; delim_argv "foo $@ bar"'
    116   1.6  christos 
    117   1.6  christos 		atf_check -s exit:0 -o inline:'>a< >b< >c<\n' -e empty \
    118   1.6  christos 			${TEST_SH} -c \
    119   1.6  christos 			". ./h-f${f}; "'set -- a b c; delim_argv "$@"'
    120   1.6  christos 		atf_check -s exit:0 -o inline:'>fooa< >b< >cbar<\n' -e empty \
    121   1.6  christos 			${TEST_SH} -c \
    122   1.6  christos 			". ./h-f${f}; "'set -- a b c; delim_argv "foo$@bar"'
    123   1.6  christos 		atf_check -s exit:0 -o inline:'>foo a< >b< >c bar<\n' -e empty \
    124   1.6  christos 			${TEST_SH} -c \
    125   1.6  christos 			". ./h-f${f}; "'set -- a b c; delim_argv "foo $@ bar"'
    126   1.6  christos 	done
    127   1.1    jruoho }
    128   1.1    jruoho 
    129   1.1    jruoho atf_test_case strip
    130   1.1    jruoho strip_head() {
    131   1.1    jruoho 	atf_set "descr" "Checks that the %% operator works and strips" \
    132   1.1    jruoho 	                "the contents of a variable from the given point" \
    133   1.6  christos 			"to the end"
    134   1.1    jruoho }
    135   1.1    jruoho strip_body() {
    136   1.1    jruoho 	line='#define bindir "/usr/bin" /* comment */'
    137   1.1    jruoho 	stripped='#define bindir "/usr/bin" '
    138   1.6  christos 
    139   1.6  christos 	# atf_expect_fail "PR bin/43469" -- now fixed
    140   1.6  christos 	for exp in 				\
    141   1.6  christos 		'${line%%/\**}'			\
    142   1.6  christos 		'${line%%"/*"*}'		\
    143   1.6  christos 		'${line%%'"'"'/*'"'"'*}'	\
    144   1.6  christos 		'"${line%%/\**}"'		\
    145   1.6  christos 		'"${line%%"/*"*}"'		\
    146   1.6  christos 		'"${line%%'"'"'/*'"'"'*}"'	\
    147   1.6  christos 		'${line%/\**}'			\
    148   1.6  christos 		'${line%"/*"*}'			\
    149   1.6  christos 		'${line%'"'"'/*'"'"'*}'		\
    150   1.6  christos 		'"${line%/\**}"'		\
    151   1.6  christos 		'"${line%"/*"*}"'		\
    152   1.6  christos 		'"${line%'"'"'/*'"'"'*}"'
    153   1.6  christos 	do
    154   1.6  christos 		atf_check -o inline:":$stripped:\n" -e empty ${TEST_SH} -c \
    155   1.6  christos 			"line='${line}'; echo :${exp}:"
    156   1.6  christos 	done
    157   1.1    jruoho }
    158   1.1    jruoho 
    159   1.1    jruoho atf_test_case varpattern_backslashes
    160   1.1    jruoho varpattern_backslashes_head() {
    161   1.1    jruoho 	atf_set "descr" "Tests that protecting wildcards with backslashes" \
    162   1.1    jruoho 	                "works in variable patterns."
    163   1.1    jruoho }
    164   1.1    jruoho varpattern_backslashes_body() {
    165   1.1    jruoho 	line='/foo/bar/*/baz'
    166   1.1    jruoho 	stripped='/foo/bar/'
    167   1.6  christos 	atf_check -o inline:'/foo/bar/\n' -e empty ${TEST_SH} -c \
    168   1.6  christos 		'line="/foo/bar/*/baz"; echo ${line%%\**}'
    169   1.1    jruoho }
    170   1.1    jruoho 
    171   1.1    jruoho atf_test_case arithmetic
    172   1.1    jruoho arithmetic_head() {
    173   1.1    jruoho 	atf_set "descr" "POSIX requires shell arithmetic to use signed" \
    174   1.1    jruoho 	                "long or a wider type.  We use intmax_t, so at" \
    175   1.1    jruoho 			"least 64 bits should be available.  Make sure" \
    176   1.1    jruoho 			"this is true."
    177   1.1    jruoho }
    178   1.1    jruoho arithmetic_body() {
    179   1.6  christos 
    180   1.6  christos 	atf_check -o inline:'3' -e empty ${TEST_SH} -c \
    181   1.6  christos 		'printf %s $((1 + 2))'
    182   1.6  christos 	atf_check -o inline:'2147483647' -e empty ${TEST_SH} -c \
    183   1.6  christos 		'printf %s $((0x7fffffff))'
    184   1.6  christos 	atf_check -o inline:'9223372036854775807' -e empty ${TEST_SH} -c \
    185   1.6  christos 		'printf %s $(((1 << 63) - 1))'
    186   1.1    jruoho }
    187   1.1    jruoho 
    188   1.2       ast atf_test_case iteration_on_null_parameter
    189   1.2       ast iteration_on_null_parameter_head() {
    190   1.2       ast 	atf_set "descr" "Check iteration of \$@ in for loop when set to null;" \
    191   1.2       ast 	                "the error \"sh: @: parameter not set\" is incorrect." \
    192   1.2       ast 	                "PR bin/48202."
    193   1.2       ast }
    194   1.2       ast iteration_on_null_parameter_body() {
    195   1.6  christos 	atf_check -o empty -e empty ${TEST_SH} -c \
    196   1.6  christos 		'N=; set -- ${N};   for X; do echo "[$X]"; done'
    197   1.6  christos }
    198   1.6  christos 
    199   1.6  christos atf_test_case iteration_on_quoted_null_parameter
    200   1.6  christos iteration_on_quoted_null_parameter_head() {
    201   1.6  christos 	atf_set "descr" \
    202   1.6  christos 		'Check iteration of "$@" in for loop when set to null;'
    203   1.6  christos }
    204   1.6  christos iteration_on_quoted_null_parameter_body() {
    205   1.6  christos 	atf_check -o inline:'[]\n' -e empty ${TEST_SH} -c \
    206   1.6  christos 		'N=; set -- "${N}"; for X; do echo "[$X]"; done'
    207   1.6  christos }
    208   1.6  christos 
    209   1.6  christos atf_test_case iteration_on_null_or_null_parameter
    210   1.6  christos iteration_on_null_or_null_parameter_head() {
    211   1.6  christos 	atf_set "descr" \
    212   1.6  christos 		'Check expansion of null parameter as default for another null'
    213   1.6  christos }
    214   1.6  christos iteration_on_null_or_null_parameter_body() {
    215   1.6  christos 	atf_check -o empty -e empty ${TEST_SH} -c \
    216   1.6  christos 		'N=; E=; set -- ${N:-${E}}; for X; do echo "[$X]"; done'
    217   1.6  christos }
    218   1.6  christos 
    219   1.6  christos atf_test_case iteration_on_null_or_missing_parameter
    220   1.6  christos iteration_on_null_or_missing_parameter_head() {
    221   1.6  christos 	atf_set "descr" \
    222   1.6  christos 	    'Check expansion of missing parameter as default for another null'
    223   1.6  christos }
    224   1.6  christos iteration_on_null_or_missing_parameter_body() {
    225   1.6  christos 	# atf_expect_fail 'PR bin/50834'
    226   1.6  christos 	atf_check -o empty -e empty ${TEST_SH} -c \
    227   1.6  christos 		'N=; set -- ${N:-}; for X; do echo "[$X]"; done'
    228   1.2       ast }
    229   1.2       ast 
    230  1.10       kre ####### The remaining tests use the following helper functions ...
    231  1.10       kre 
    232   1.7  christos nl='
    233   1.7  christos '
    234   1.7  christos reset()
    235   1.7  christos {
    236   1.7  christos 	TEST_NUM=0
    237   1.7  christos 	TEST_FAILURES=''
    238   1.7  christos 	TEST_FAIL_COUNT=0
    239   1.7  christos 	TEST_ID="$1"
    240   1.7  christos }
    241   1.7  christos 
    242   1.7  christos check()
    243   1.7  christos {
    244   1.7  christos 	fail=false
    245   1.7  christos 	TEMP_FILE=$( mktemp OUT.XXXXXX )
    246   1.7  christos 	TEST_NUM=$(( $TEST_NUM + 1 ))
    247   1.7  christos 	MSG=
    248   1.7  christos 
    249   1.7  christos 	# our local shell (ATF_SHELL) better do quoting correctly...
    250   1.7  christos 	# some of the tests expect us to expand $nl internally...
    251   1.7  christos 	CMD="$1"
    252   1.7  christos 
    253   1.7  christos 	result="$( ${TEST_SH} -c "${CMD}" 2>"${TEMP_FILE}" )"
    254   1.7  christos 	STATUS=$?
    255   1.7  christos 
    256   1.7  christos 	if [ "${STATUS}" -ne "$3" ]; then
    257   1.7  christos 		MSG="${MSG}${MSG:+${nl}}[$TEST_NUM]"
    258   1.7  christos 		MSG="${MSG} expected exit code $3, got ${STATUS}"
    259   1.7  christos 
    260   1.7  christos 		# don't actually fail just because of wrong exit code
    261   1.7  christos 		# unless we either expected, or received "good"
    262   1.7  christos 		case "$3/${STATUS}" in
    263   1.7  christos 		(*/0|0/*) fail=true;;
    264   1.7  christos 		esac
    265   1.7  christos 	fi
    266   1.7  christos 
    267   1.7  christos 	if [ "$3" -eq 0 ]; then
    268   1.7  christos 		if [ -s "${TEMP_FILE}" ]; then
    269   1.7  christos 			MSG="${MSG}${MSG:+${nl}}[$TEST_NUM]"
    270   1.7  christos 			MSG="${MSG} Messages produced on stderr unexpected..."
    271   1.7  christos 			MSG="${MSG}${nl}$( cat "${TEMP_FILE}" )"
    272   1.7  christos 			fail=true
    273   1.7  christos 		fi
    274   1.7  christos 	else
    275   1.7  christos 		if ! [ -s "${TEMP_FILE}" ]; then
    276   1.7  christos 			MSG="${MSG}${MSG:+${nl}}[$TEST_NUM]"
    277   1.7  christos 			MSG="${MSG} Expected messages on stderr,"
    278   1.7  christos 			MSG="${MSG} nothing produced"
    279   1.7  christos 			fail=true
    280   1.7  christos 		fi
    281   1.7  christos 	fi
    282   1.7  christos 	rm -f "${TEMP_FILE}"
    283   1.7  christos 
    284   1.7  christos 	# Remove newlines (use local shell for this)
    285   1.7  christos 	oifs="$IFS"
    286   1.7  christos 	IFS="$nl"
    287   1.7  christos 	result="$(echo $result)"
    288   1.7  christos 	IFS="$oifs"
    289   1.7  christos 	if [ "$2" != "$result" ]
    290   1.7  christos 	then
    291   1.7  christos 		MSG="${MSG}${MSG:+${nl}}[$TEST_NUM]"
    292   1.7  christos 		MSG="${MSG} Expected output '$2', received '$result'"
    293   1.7  christos 		fail=true
    294   1.7  christos 	fi
    295   1.7  christos 
    296   1.7  christos 	if $fail
    297   1.7  christos 	then
    298   1.7  christos 		MSG="${MSG}${MSG:+${nl}}[$TEST_NUM]"
    299   1.7  christos 		MSG="${MSG} Full command: <<${CMD}>>"
    300   1.7  christos 	fi
    301   1.7  christos 
    302   1.7  christos 	$fail && test -n "$TEST_ID" && {
    303   1.7  christos 		TEST_FAILURES="${TEST_FAILURES}${TEST_FAILURES:+${nl}}"
    304   1.7  christos 		TEST_FAILURES="${TEST_FAILURES}${TEST_ID}[$TEST_NUM]:"
    305   1.7  christos 		TEST_FAILURES="${TEST_FAILURES} Test of '$1' failed.";
    306   1.7  christos 		TEST_FAILURES="${TEST_FAILURES}${nl}${MSG}"
    307   1.7  christos 		TEST_FAIL_COUNT=$(( $TEST_FAIL_COUNT + 1 ))
    308   1.7  christos 		return 0
    309   1.7  christos 	}
    310   1.7  christos 	$fail && atf_fail "Test[$TEST_NUM] of '$1' failed${nl}${MSG}"
    311   1.7  christos 	return 0
    312   1.7  christos }
    313   1.7  christos 
    314   1.7  christos results()
    315   1.7  christos {
    316  1.10       kre 	test -n "$1" && atf_expect_fail "$1"
    317  1.10       kre 
    318   1.7  christos 	test -z "${TEST_ID}" && return 0
    319   1.7  christos 	test -z "${TEST_FAILURES}" && return 0
    320   1.7  christos 
    321   1.7  christos 	echo >&2 "=========================================="
    322   1.7  christos 	echo >&2 "While testing '${TEST_ID}'"
    323   1.7  christos 	echo >&2 " - - - - - - - - - - - - - - - - -"
    324   1.7  christos 	echo >&2 "${TEST_FAILURES}"
    325  1.10       kre 
    326   1.7  christos 	atf_fail \
    327   1.9       kre  "Test ${TEST_ID}: $TEST_FAIL_COUNT (of $TEST_NUM) subtests failed - see stderr"
    328   1.7  christos }
    329   1.7  christos 
    330  1.10       kre ####### End helpers
    331  1.10       kre 
    332   1.7  christos atf_test_case shell_params
    333   1.7  christos shell_params_head() {
    334   1.7  christos 	atf_set "descr" "Test correct operation of the numeric parameters"
    335   1.7  christos }
    336   1.7  christos shell_params_body() {
    337   1.7  christos 	atf_require_prog mktemp
    338   1.7  christos 
    339   1.7  christos 	reset shell_params
    340   1.7  christos 
    341   1.7  christos 	check 'set -- a b c; echo "$#: $1 $2 $3"' '3: a b c' 0
    342   1.7  christos 	check 'set -- a b c d e f g h i j k l m; echo "$#: ${1}0 ${10} $10"' \
    343   1.7  christos 		'13: a0 j a0' 0
    344   1.7  christos 	check 'x="$0"; set -- a b; y="$0";
    345   1.7  christos 	      [ "x${x}y" = "x${y}y" ] && echo OK || echo x="$x" y="$y"' \
    346   1.7  christos 		'OK' 0
    347   1.7  christos 	check "${TEST_SH} -c 'echo 0=\$0 1=\$1 2=\$2' a b c" '0=a 1=b 2=c' 0
    348   1.7  christos 
    349   1.7  christos 	echo 'echo 0="$0" 1="$1" 2="$2"' > helper.sh
    350   1.8  christos 	check "${TEST_SH} helper.sh a b c" '0=helper.sh 1=a 2=b' 0
    351   1.7  christos 
    352   1.7  christos 	check 'set -- a bb ccc dddd eeeee ffffff ggggggg hhhhhhhh \
    353   1.7  christos 		iiiiiiiii jjjjjjjjjj kkkkkkkkkkk
    354   1.7  christos 	       echo "${#}: ${#1} ${#2} ${#3} ${#4} ... ${#9} ${#10} ${#11}"' \
    355   1.7  christos 		 '11: 1 2 3 4 ... 9 10 11' 0
    356   1.7  christos 
    357   1.7  christos 	check 'set -- a b c; echo "$#: ${1-A} ${2-B} ${3-C} ${4-D} ${5-E}"' \
    358   1.7  christos 		'3: a b c D E' 0
    359   1.7  christos 	check 'set -- a "" c "" e
    360   1.7  christos 	       echo "$#: ${1:-A} ${2:-B} ${3:-C} ${4:-D} ${5:-E}"' \
    361   1.7  christos 		'5: a B c D e' 0
    362   1.7  christos 	check 'set -- a "" c "" e
    363   1.7  christos 	       echo "$#: ${1:+A} ${2:+B} ${3:+C} ${4:+D} ${5:+E}"' \
    364   1.7  christos 		'5: A  C  E' 0
    365   1.7  christos 	check 'set -- "abab*cbb"
    366   1.7  christos 	       echo "${1} ${1#a} ${1%b} ${1##ab} ${1%%b} ${1#*\*} ${1%\**}"' \
    367   1.7  christos 	       'abab*cbb bab*cbb abab*cb ab*cbb abab*cb cbb abab' 0
    368   1.7  christos 	check 'set -- "abab?cbb"
    369   1.7  christos     echo "${1}:${1#*a}+${1%b*}-${1##*a}_${1%%b*}%${1#[ab]}=${1%?*}/${1%\?*}"' \
    370   1.7  christos 	       'abab?cbb:bab?cbb+abab?cb-b?cbb_a%bab?cbb=abab?cb/abab' 0
    371   1.7  christos 	check 'set -- a "" c "" e; echo "${2:=b}"' '' 1
    372   1.7  christos 
    373   1.7  christos 	results
    374   1.7  christos }
    375   1.7  christos 
    376   1.9       kre atf_test_case var_with_embedded_cmdsub
    377   1.9       kre var_with_embedded_cmdsub_head() {
    378   1.9       kre 	atf_set "descr" "Test expansion of vars with embedded cmdsub"
    379   1.9       kre }
    380   1.9       kre var_with_embedded_cmdsub_body() {
    381   1.9       kre 
    382   1.9       kre 	reset var_with_embedded_cmdsub
    383   1.9       kre 
    384   1.9       kre 	check 'unset x; echo ${x-$(echo a)}$(echo b)'  'ab' 0	#1
    385   1.9       kre 	check 'unset x; echo ${x:-$(echo a)}$(echo b)' 'ab' 0	#2
    386   1.9       kre 	check 'x=""; echo ${x-$(echo a)}$(echo b)'     'b'  0	#3
    387   1.9       kre 	check 'x=""; echo ${x:-$(echo a)}$(echo b)'    'ab' 0	#4
    388   1.9       kre 	check 'x=c; echo ${x-$(echo a)}$(echo b)'      'cb' 0	#5
    389   1.9       kre 	check 'x=c; echo ${x:-$(echo a)}$(echo b)'     'cb' 0	#6
    390   1.9       kre 
    391   1.9       kre 	check 'unset x; echo ${x+$(echo a)}$(echo b)'  'b'  0	#7
    392   1.9       kre 	check 'unset x; echo ${x:+$(echo a)}$(echo b)' 'b'  0	#8
    393   1.9       kre 	check 'x=""; echo ${x+$(echo a)}$(echo b)'     'ab' 0	#9
    394   1.9       kre 	check 'x=""; echo ${x:+$(echo a)}$(echo b)'    'b'  0	#10
    395   1.9       kre 	check 'x=c; echo ${x+$(echo a)}$(echo b)'      'ab' 0	#11
    396   1.9       kre 	check 'x=c; echo ${x:+$(echo a)}$(echo b)'     'ab' 0	#12
    397   1.9       kre 
    398   1.9       kre 	check 'unset x; echo ${x=$(echo a)}$(echo b)'  'ab' 0	#13
    399   1.9       kre 	check 'unset x; echo ${x:=$(echo a)}$(echo b)' 'ab' 0	#14
    400   1.9       kre 	check 'x=""; echo ${x=$(echo a)}$(echo b)'     'b'  0	#15
    401   1.9       kre 	check 'x=""; echo ${x:=$(echo a)}$(echo b)'    'ab' 0	#16
    402   1.9       kre 	check 'x=c; echo ${x=$(echo a)}$(echo b)'      'cb' 0	#17
    403   1.9       kre 	check 'x=c; echo ${x:=$(echo a)}$(echo b)'     'cb' 0	#18
    404   1.9       kre 
    405   1.9       kre 	check 'unset x; echo ${x?$(echo a)}$(echo b)'  ''   2	#19
    406   1.9       kre 	check 'unset x; echo ${x:?$(echo a)}$(echo b)' ''   2	#20
    407   1.9       kre 	check 'x=""; echo ${x?$(echo a)}$(echo b)'     'b'  0	#21
    408   1.9       kre 	check 'x=""; echo ${x:?$(echo a)}$(echo b)'    ''   2	#22
    409   1.9       kre 	check 'x=c; echo ${x?$(echo a)}$(echo b)'      'cb' 0	#23
    410   1.9       kre 	check 'x=c; echo ${x:?$(echo a)}$(echo b)'     'cb' 0	#24
    411   1.9       kre 
    412   1.9       kre 	check 'unset x; echo ${x%$(echo a)}$(echo b)'  'b'  0	#25
    413   1.9       kre 	check 'unset x; echo ${x%%$(echo a)}$(echo b)' 'b'  0	#26
    414   1.9       kre 	check 'x=""; echo ${x%$(echo a)}$(echo b)'     'b'  0	#27
    415   1.9       kre 	check 'x=""; echo ${x%%$(echo a)}$(echo b)'    'b'  0	#28
    416   1.9       kre 	check 'x=c; echo ${x%$(echo a)}$(echo b)'      'cb' 0	#29
    417   1.9       kre 	check 'x=c; echo ${x%%$(echo a)}$(echo b)'     'cb' 0	#30
    418   1.9       kre 	check 'x=aa; echo ${x%$(echo "*a")}$(echo b)'  'ab' 0	#31
    419   1.9       kre 	check 'x=aa; echo ${x%%$(echo "*a")}$(echo b)' 'b'  0	#32
    420   1.9       kre 
    421   1.9       kre 	check 'unset x; echo ${x#$(echo a)}$(echo b)'  'b'  0	#33
    422   1.9       kre 	check 'unset x; echo ${x##$(echo a)}$(echo b)' 'b'  0	#34
    423   1.9       kre 	check 'x=""; echo ${x#$(echo a)}$(echo b)'     'b'  0	#35
    424   1.9       kre 	check 'x=""; echo ${x##$(echo a)}$(echo b)'    'b'  0	#36
    425   1.9       kre 	check 'x=c; echo ${x#$(echo a)}$(echo b)'      'cb' 0	#37
    426   1.9       kre 	check 'x=c; echo ${x##$(echo a)}$(echo b)'     'cb' 0	#38
    427   1.9       kre 	check 'x=aa; echo ${x#$(echo "*a")}$(echo b)'  'ab' 0	#39
    428   1.9       kre 	check 'x=aa; echo ${x##$(echo "*a")}$(echo b)' 'b'  0	#40
    429   1.9       kre 
    430   1.9       kre 	results
    431   1.9       kre }
    432   1.9       kre 
    433  1.10       kre atf_test_case dollar_star
    434  1.10       kre dollar_star_head() {
    435  1.10       kre 	atf_set "descr" 'Test expansion of various aspects of $*'
    436  1.10       kre }
    437  1.10       kre dollar_star_body() {
    438  1.10       kre 
    439  1.10       kre 	reset # dollar_star
    440  1.10       kre 
    441  1.10       kre 	check 'set -- a b c; echo $# $*'		'3 a b c'	0  # 1
    442  1.10       kre 	check 'set -- a b c; echo $# "$*"'		'3 a b c'	0  # 2
    443  1.10       kre 	check 'set -- a "b c"; echo $# $*'		'2 a b c'	0  # 3
    444  1.10       kre 	check 'set -- a "b c"; echo $# "$*"'		'2 a b c'	0  # 4
    445  1.10       kre 	check 'set -- a b c; set -- $* ; echo $# $*'	'3 a b c'	0  # 5
    446  1.10       kre 	check 'set -- a b c; set -- "$*" ; echo $# $*'	'1 a b c'	0  # 6
    447  1.10       kre 	check 'set -- a "b c"; set -- $* ; echo $# $*'	'3 a b c'	0  # 7
    448  1.10       kre 	check 'set -- a "b c"; set -- "$*" ; echo $# $*' \
    449  1.10       kre 							'1 a b c'	0  # 8
    450  1.10       kre 
    451  1.10       kre 	check 'IFS=". "; set -- a b c; echo $# $*'	'3 a b c'	0  # 9
    452  1.10       kre 	check 'IFS=". "; set -- a b c; echo $# "$*"'	'3 a.b.c'	0  #10
    453  1.10       kre 	check 'IFS=". "; set -- a "b c"; echo $# $*'	'2 a b c'	0  #11
    454  1.10       kre 	check 'IFS=". "; set -- a "b c"; echo $# "$*"'	'2 a.b c'	0  #12
    455  1.10       kre 	check 'IFS=". "; set -- a "b.c"; echo $# $*'	'2 a b c'	0  #13
    456  1.10       kre 	check 'IFS=". "; set -- a "b.c"; echo $# "$*"'	'2 a.b.c'	0  #14
    457  1.10       kre 	check 'IFS=". "; set -- a b c; set -- $* ; echo $# $*' \
    458  1.10       kre 							'3 a b c'	0  #15
    459  1.10       kre 	check 'IFS=". "; set -- a b c; set -- "$*" ; echo $# $*' \
    460  1.10       kre 							'1 a b c'	0  #16
    461  1.10       kre 	check 'IFS=". "; set -- a "b c"; set -- $* ; echo $# $*' \
    462  1.10       kre 							'3 a b c'	0  #17
    463  1.10       kre 	check 'IFS=". "; set -- a "b c"; set -- "$*" ; echo $# $*' \
    464  1.10       kre 							'1 a b c'	0  #18
    465  1.10       kre 	check 'IFS=". "; set -- a b c; set -- $* ; echo $# "$*"' \
    466  1.10       kre 							'3 a.b.c'	0  #19
    467  1.10       kre 	check 'IFS=". "; set -- a b c; set -- "$*" ; echo $# "$*"' \
    468  1.10       kre 							'1 a.b.c'	0  #20
    469  1.10       kre 	check 'IFS=". "; set -- a "b c"; set -- $* ; echo $# "$*"' \
    470  1.10       kre 							'3 a.b.c'	0  #21
    471  1.10       kre 	check 'IFS=". "; set -- a "b c"; set -- "$*" ; echo $# "$*"' \
    472  1.10       kre 							'1 a.b c'	0  #22
    473  1.10       kre 
    474  1.10       kre 	results
    475  1.10       kre }
    476  1.10       kre 
    477  1.10       kre atf_test_case dollar_star_in_word
    478  1.10       kre dollar_star_in_word_head() {
    479  1.10       kre 	atf_set "descr" 'Test expansion $* occurring in word of ${var:-word}'
    480  1.10       kre }
    481  1.10       kre dollar_star_in_word_body() {
    482  1.10       kre 
    483  1.10       kre 	reset dollar_star_in_word
    484  1.10       kre 
    485  1.10       kre 	unset xXx			; # just in case!
    486  1.10       kre 
    487  1.10       kre 	# Note that the expected results for these tests are identical
    488  1.10       kre 	# to those from the dollar_star test.   It should never make
    489  1.10       kre 	# a difference whether we expand $* or ${unset:-$*}
    490  1.10       kre 
    491  1.10       kre 	# (note expanding ${unset:-"$*"} is different, that is not tested here)
    492  1.10       kre 
    493  1.10       kre 	check 'set -- a b c; echo $# ${xXx:-$*}'		'3 a b c' 0  # 1
    494  1.10       kre 	check 'set -- a b c; echo $# "${xXx:-$*}"'		'3 a b c' 0  # 2
    495  1.10       kre 	check 'set -- a "b c"; echo $# ${xXx:-$*}'		'2 a b c' 0  # 3
    496  1.10       kre 	check 'set -- a "b c"; echo $# "${xXx:-$*}"'		'2 a b c' 0  # 4
    497  1.10       kre 	check 'set -- a b c; set -- ${xXx:-$*} ; echo $# $*'	'3 a b c' 0  # 5
    498  1.10       kre 	check 'set -- a b c; set -- "${xXx:-$*}" ; echo $# $*'	'1 a b c' 0  # 6
    499  1.10       kre 	check 'set -- a "b c"; set -- ${xXx:-$*} ; echo $# $*'	'3 a b c' 0  # 7
    500  1.10       kre 	check 'set -- a "b c"; set -- "${xXx:-$*}" ; echo $# $*' \
    501  1.10       kre 								'1 a b c' 0  # 8
    502  1.10       kre 
    503  1.10       kre 	check 'IFS=". "; set -- a b c; echo $# ${xXx:-$*}'	'3 a b c' 0  # 9
    504  1.10       kre 	check 'IFS=". "; set -- a b c; echo $# "${xXx:-$*}"'	'3 a.b.c' 0  #10
    505  1.10       kre 	check 'IFS=". "; set -- a "b c"; echo $# ${xXx:-$*}'	'2 a b c' 0  #11
    506  1.10       kre 	check 'IFS=". "; set -- a "b c"; echo $# "${xXx:-$*}"'	'2 a.b c' 0  #12
    507  1.10       kre 	check 'IFS=". "; set -- a "b.c"; echo $# ${xXx:-$*}'	'2 a b c' 0  #13
    508  1.10       kre 	check 'IFS=". "; set -- a "b.c"; echo $# "${xXx:-$*}"'	'2 a.b.c' 0  #14
    509  1.10       kre 	check 'IFS=". ";set -- a b c;set -- ${xXx:-$*};echo $# ${xXx:-$*}' \
    510  1.10       kre 								'3 a b c' 0  #15
    511  1.10       kre 	check 'IFS=". ";set -- a b c;set -- "${xXx:-$*}";echo $# ${xXx:-$*}' \
    512  1.10       kre 								'1 a b c' 0  #16
    513  1.10       kre 	check 'IFS=". ";set -- a "b c";set -- ${xXx:-$*};echo $# ${xXx:-$*}' \
    514  1.10       kre 								'3 a b c' 0  #17
    515  1.10       kre 	check 'IFS=". ";set -- a "b c";set -- "${xXx:-$*}";echo $# ${xXx:-$*}' \
    516  1.10       kre 								'1 a b c' 0  #18
    517  1.10       kre 	check 'IFS=". ";set -- a b c;set -- ${xXx:-$*};echo $# "${xXx:-$*}"' \
    518  1.10       kre 								'3 a.b.c' 0  #19
    519  1.10       kre 	check 'IFS=". ";set -- a b c;set -- "$*";echo $# "$*"' \
    520  1.10       kre 								'1 a.b.c' 0  #20
    521  1.10       kre 	check 'IFS=". ";set -- a "b c";set -- $*;echo $# "$*"' \
    522  1.10       kre 								'3 a.b.c' 0  #21
    523  1.10       kre 	check 'IFS=". ";set -- a "b c";set -- "$*";echo $# "$*"' \
    524  1.10       kre 								'1 a.b c' 0  #22
    525  1.10       kre 
    526  1.10       kre 	results
    527  1.10       kre }
    528  1.10       kre 
    529  1.10       kre atf_test_case dollar_star_with_empty_ifs
    530  1.10       kre dollar_star_with_empty_ifs_head() {
    531  1.10       kre 	atf_set "descr" 'Test expansion of $* with IFS=""'
    532  1.10       kre }
    533  1.10       kre dollar_star_with_empty_ifs_body() {
    534  1.10       kre 
    535  1.10       kre 	reset dollar_star_with_empty_ifs
    536  1.10       kre 
    537  1.10       kre 	check 'IFS=""; set -- a b c; echo $# $*'	'3 a b c'	0  # 1
    538  1.10       kre 	check 'IFS=""; set -- a b c; echo $# "$*"'	'3 abc'		0  # 2
    539  1.10       kre 	check 'IFS=""; set -- a "b c"; echo $# $*'	'2 a b c'	0  # 3
    540  1.10       kre 	check 'IFS=""; set -- a "b c"; echo $# "$*"'	'2 ab c'	0  # 4
    541  1.10       kre 	check 'IFS=""; set -- a "b.c"; echo $# $*'	'2 a b.c'	0  # 5
    542  1.10       kre 	check 'IFS=""; set -- a "b.c"; echo $# "$*"'	'2 ab.c'	0  # 6
    543  1.10       kre 	check 'IFS=""; set -- a b c; set -- $* ; echo $# $*' \
    544  1.10       kre 							'3 a b c'	0  # 7
    545  1.10       kre 	check 'IFS=""; set -- a b c; set -- "$*" ; echo $# $*' \
    546  1.10       kre 							'1 abc'		0  # 8
    547  1.10       kre 	check 'IFS=""; set -- a "b c"; set -- $* ; echo $# $*' \
    548  1.10       kre 							'2 a b c'	0  # 9
    549  1.10       kre 	check 'IFS=""; set -- a "b c"; set -- "$*" ; echo $# $*' \
    550  1.10       kre 							'1 ab c'	0  #10
    551  1.10       kre 	check 'IFS=""; set -- a b c; set -- $* ; echo $# "$*"' \
    552  1.10       kre 							'3 abc'		0  #11
    553  1.10       kre 	check 'IFS=""; set -- a b c; set -- "$*" ; echo $# "$*"' \
    554  1.10       kre 							'1 abc'		0  #12
    555  1.10       kre 	check 'IFS=""; set -- a "b c"; set -- $* ; echo $# "$*"' \
    556  1.10       kre 							'2 ab c'	0  #13
    557  1.10       kre 	check 'IFS=""; set -- a "b c"; set -- "$*" ; echo $# "$*"' \
    558  1.10       kre 							'1 ab c'	0  #14
    559  1.10       kre 
    560  1.10       kre 	results			'PR bin/52090 expect 7 of 14 subtests to fail'
    561  1.10       kre }
    562  1.10       kre 
    563  1.10       kre atf_test_case dollar_star_in_word_empty_ifs
    564  1.10       kre dollar_star_in_word_empty_ifs_head() {
    565  1.10       kre 	atf_set "descr" 'Test expansion of ${unset:-$*} with IFS=""'
    566  1.10       kre }
    567  1.10       kre dollar_star_in_word_empty_ifs_body() {
    568  1.10       kre 
    569  1.10       kre 	reset dollar_star_in_word_empty_ifs
    570  1.10       kre 
    571  1.10       kre 	unset xXx			; # just in case
    572  1.10       kre 
    573  1.10       kre 	# Note that the expected results for these tests are identical
    574  1.10       kre 	# to those from the dollar_star_with_empty_ifs test.   It should
    575  1.10       kre 	# never make a difference whether we expand $* or ${unset:-$*}
    576  1.10       kre 
    577  1.10       kre 	# (note expanding ${unset:-"$*"} is different, that is not tested here)
    578  1.10       kre 
    579  1.10       kre 	check 'IFS="";set -- a b c;echo $# ${xXx:-$*}'		'3 a b c' 0  # 1
    580  1.10       kre 	check 'IFS="";set -- a b c;echo $# "${xXx:-$*}"'	'3 abc'	  0  # 2
    581  1.10       kre 	check 'IFS="";set -- a "b c";echo $# ${xXx:-$*}'	'2 a b c' 0  # 3
    582  1.10       kre 	check 'IFS="";set -- a "b c";echo $# "${xXx:-$*}"'	'2 ab c'  0  # 4
    583  1.10       kre 	check 'IFS="";set -- a "b.c";echo $# ${xXx:-$*}'	'2 a b.c' 0  # 5
    584  1.10       kre 	check 'IFS="";set -- a "b.c";echo $# "${xXx:-$*}"'	'2 ab.c'  0  # 6
    585  1.10       kre 	check 'IFS="";set -- a b c;set -- ${xXx:-$*};echo $# ${xXx:-$*}' \
    586  1.10       kre 								'3 a b c' 0  # 7
    587  1.10       kre 	check 'IFS="";set -- a b c;set -- "${xXx:-$*}";echo $# ${xXx:-$*}' \
    588  1.10       kre 								'1 abc'   0  # 8
    589  1.10       kre 	check 'IFS="";set -- a "b c";set -- ${xXx:-$*};echo $# ${xXx:-$*}' \
    590  1.10       kre 								'2 a b c' 0  # 9
    591  1.10       kre 	check 'IFS="";set -- a "b c";set -- "${xXx:-$*}";echo $# ${xXx:-$*}' \
    592  1.10       kre 								'1 ab c'  0  #10
    593  1.10       kre 	check 'IFS="";set -- a b c;set -- ${xXx:-$*};echo $# "${xXx:-$*}"' \
    594  1.10       kre 								'3 abc'	  0  #11
    595  1.10       kre 	check 'IFS="";set -- a b c;set -- "${xXx:-$*}";echo $# "${xXx:-$*}"' \
    596  1.10       kre 								'1 abc'	  0  #12
    597  1.10       kre 	check 'IFS="";set -- a "b c";set -- ${xXx:-$*};echo $# "${xXx:-$*}"' \
    598  1.10       kre 								'2 ab c'  0  #13
    599  1.10       kre 	check 'IFS="";set -- a "b c";set -- "${xXx:-$*}";echo $# "${xXx:-$*}"' \
    600  1.10       kre 								'1 ab c'  0  #14
    601  1.10       kre 
    602  1.10       kre 	results		'PR bin/52090 expect 7 of 14 subtests to fail'
    603  1.10       kre }
    604  1.10       kre 
    605  1.10       kre atf_test_case dollar_star_in_quoted_word
    606  1.10       kre dollar_star_in_quoted_word_head() {
    607  1.10       kre 	atf_set "descr" 'Test expansion $* occurring in word of ${var:-"word"}'
    608  1.10       kre }
    609  1.10       kre dollar_star_in_quoted_word_body() {
    610  1.10       kre 
    611  1.10       kre 	reset dollar_star_in_quoted_word
    612  1.10       kre 
    613  1.10       kre 	unset xXx			; # just in case!
    614  1.10       kre 
    615  1.10       kre 	check 'set -- a b c; echo $# ${xXx:-"$*"}'		'3 a b c' 0  # 1
    616  1.10       kre 	check 'set -- a "b c"; echo $# ${xXx:-"$*"}'		'2 a b c' 0  # 2
    617  1.10       kre 	check 'set -- a b c; set -- ${xXx:-"$*"} ; echo $# ${xXx-"$*"}' \
    618  1.10       kre 								'1 a b c' 0  # 3
    619  1.10       kre 	check 'set -- a "b c"; set -- ${xXx:-"$*"} ; echo $# ${xXx-"$*"}' \
    620  1.10       kre 								'1 a b c' 0  # 4
    621  1.10       kre 	check 'set -- a b c; set -- ${xXx:-"$*"} ; echo $# ${xXx-"$*"}' \
    622  1.10       kre 								'1 a b c' 0  # 5
    623  1.10       kre 	check 'set -- a "b c"; set -- ${xXx:-"$*"} ; echo $# ${xXx-$*}' \
    624  1.10       kre 								'1 a b c' 0  # 6
    625  1.10       kre 	check 'set -- a b c; set -- ${xXx:-$*} ; echo $# ${xXx-"$*"}' \
    626  1.10       kre 								'3 a b c' 0  # 7
    627  1.10       kre 	check 'set -- a "b c"; set -- ${xXx:-$*} ; echo $# ${xXx-"$*"}' \
    628  1.10       kre 								'3 a b c' 0  # 8
    629  1.10       kre 
    630  1.10       kre 	check 'IFS=". "; set -- a b c; echo $# ${xXx:-"$*"}'	'3 a.b.c' 0  # 9
    631  1.10       kre 	check 'IFS=". "; set -- a "b c"; echo $# ${xXx:-"$*"}'	'2 a.b c' 0  #10
    632  1.10       kre 	check 'IFS=". "; set -- a "b.c"; echo $# ${xXx:-"$*"}'	'2 a.b.c' 0  #11
    633  1.10       kre 	check 'IFS=". ";set -- a b c;set -- ${xXx:-"$*"};echo $# ${xXx:-"$*"}' \
    634  1.10       kre 								'1 a.b.c' 0  #12
    635  1.10       kre       check 'IFS=". ";set -- a "b c";set -- ${xXx:-"$*"};echo $# ${xXx:-"$*"}' \
    636  1.10       kre 								'1 a.b c' 0  #13
    637  1.10       kre 	check 'IFS=". ";set -- a b c;set -- ${xXx:-$*};echo $# ${xXx:-"$*"}' \
    638  1.10       kre 								'3 a.b.c' 0  #14
    639  1.10       kre 	check 'IFS=". ";set -- a "b c";set -- ${xXx:-$*};echo $# ${xXx:-"$*"}' \
    640  1.10       kre 								'3 a.b.c' 0  #15
    641  1.10       kre 	check 'IFS=". ";set -- a b c;set -- ${xXx:-"$*"};echo $# ${xXx:-$*}' \
    642  1.10       kre 								'1 a b c' 0  #16
    643  1.10       kre 	check 'IFS=". ";set -- a "b c";set -- ${xXx:-"$*"};echo $# ${xXx:-$*}' \
    644  1.10       kre 								'1 a b c' 0  #17
    645  1.10       kre 
    646  1.10       kre 	check 'IFS="";set -- a b c;echo $# ${xXx:-"$*"}'	'3 abc'   0  #18
    647  1.10       kre 	check 'IFS="";set -- a "b c";echo $# ${xXx:-"$*"}'	'2 ab c'  0  #19
    648  1.10       kre 	check 'IFS="";set -- a "b.c";echo $# ${xXx:-"$*"}'	'2 ab.c'  0  #20
    649  1.10       kre 	check 'IFS="";set -- a b c;set -- ${xXx:-"$*"};echo $# ${xXx:-"$*"}' \
    650  1.10       kre 								'1 abc'   0  #21
    651  1.10       kre 	check 'IFS="";set -- a "b c";set -- ${xXx:-"$*"};echo $# ${xXx:-"$*"}' \
    652  1.10       kre 								'1 ab c'  0  #22
    653  1.10       kre 	check 'IFS="";set -- a b c;set -- ${xXx:-$*};echo $# ${xXx:-"$*"}' \
    654  1.10       kre 								'3 abc'   0  #23
    655  1.10       kre 	check 'IFS="";set -- a "b c";set -- ${xXx:-$*};echo $# ${xXx:-"$*"}' \
    656  1.10       kre 								'2 ab c'  0  #24
    657  1.10       kre 	check 'IFS="";set -- a b c;set -- ${xXx:-"$*"};echo $# ${xXx:-$*}' \
    658  1.10       kre 								'1 abc'   0  #25
    659  1.10       kre 	check 'IFS="";set -- a "b c";set -- ${xXx:-"$*"};echo $# ${xXx:-$*}' \
    660  1.10       kre 								'1 ab c'  0  #26
    661  1.10       kre 
    662  1.10       kre 	results		 'PR bin/52090 - 2 of 26 subtests expected to fail'
    663  1.10       kre }
    664  1.10       kre 
    665   1.1    jruoho atf_init_test_cases() {
    666  1.10       kre 	# Listed here in the order ATF runs them, not the order from above
    667  1.10       kre 
    668  1.10       kre 	atf_add_test_case arithmetic
    669   1.1    jruoho 	atf_add_test_case dollar_at
    670   1.1    jruoho 	atf_add_test_case dollar_at_with_text
    671  1.10       kre 	atf_add_test_case dollar_star
    672  1.10       kre 	atf_add_test_case dollar_star_in_quoted_word
    673  1.10       kre 	atf_add_test_case dollar_star_in_word
    674  1.10       kre 	atf_add_test_case dollar_star_in_word_empty_ifs
    675  1.10       kre 	atf_add_test_case dollar_star_with_empty_ifs
    676   1.2       ast 	atf_add_test_case iteration_on_null_parameter
    677   1.6  christos 	atf_add_test_case iteration_on_quoted_null_parameter
    678   1.6  christos 	atf_add_test_case iteration_on_null_or_null_parameter
    679   1.6  christos 	atf_add_test_case iteration_on_null_or_missing_parameter
    680   1.7  christos 	atf_add_test_case shell_params
    681  1.10       kre 	atf_add_test_case strip
    682   1.9       kre 	atf_add_test_case var_with_embedded_cmdsub
    683  1.10       kre 	atf_add_test_case varpattern_backslashes
    684   1.1    jruoho }
    685