xref: /netbsd-src/tests/bin/sh/t_expand.sh (revision 7c192b2a5e1093666e67801684f930ef49b3b363)
1# $NetBSD: t_expand.sh,v 1.17 2017/06/03 14:45:59 kre Exp $
2#
3# Copyright (c) 2007, 2009 The NetBSD Foundation, Inc.
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12#    notice, this list of conditions and the following disclaimer in the
13#    documentation and/or other materials provided with the distribution.
14#
15# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25# POSSIBILITY OF SUCH DAMAGE.
26#
27# the implementation of "sh" to test
28: ${TEST_SH:="/bin/sh"}
29
30#
31# This file tests the functions in expand.c.
32#
33
34delim_argv() {
35	str=
36	while [ $# -gt 0 ]; do
37		if [ -z "${str}" ]; then
38			str=">$1<"
39		else
40			str="${str} >$1<"
41		fi
42		shift
43	done
44	echo ${str}
45}
46
47atf_test_case dollar_at
48dollar_at_head() {
49	atf_set "descr" "Somewhere between 2.0.2 and 3.0 the expansion" \
50	                "of the \$@ variable had been broken.  Check for" \
51			"this behavior."
52}
53dollar_at_body() {
54	# This one should work everywhere.
55	atf_check -s exit:0 -o inline:' EOL\n' -e empty \
56		${TEST_SH} -c 'echo "" "" | '" sed 's,\$,EOL,'"
57
58	# This code triggered the bug.
59	atf_check -s exit:0 -o inline:' EOL\n' -e empty \
60		${TEST_SH} -c 'set -- "" ""; echo "$@" | '" sed 's,\$,EOL,'"
61
62	atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \
63		'set -- -; shift; n_arg() { echo $#; }; n_arg "$@"'
64}
65
66atf_test_case dollar_at_with_text
67dollar_at_with_text_head() {
68	atf_set "descr" "Test \$@ expansion when it is surrounded by text" \
69	                "within the quotes.  PR bin/33956."
70}
71dollar_at_with_text_body() {
72
73	cat <<'EOF' > h-f1
74
75delim_argv() {
76	str=
77	while [ $# -gt 0 ]; do
78		if [ -z "${str}" ]; then
79			str=">$1<"
80		else
81			str="${str} >$1<"
82		fi
83		shift
84	done
85	echo "${str}"
86}
87
88EOF
89	cat <<'EOF' > h-f2
90
91delim_argv() {
92	str=
93	while [ $# -gt 0 ]; do
94
95		str="${str}${str:+ }>$1<"
96		shift
97
98	done
99	echo "${str}"
100}
101
102EOF
103
104	chmod +x h-f1 h-f2
105
106	for f in 1 2
107	do
108		atf_check -s exit:0 -o inline:'\n' -e empty ${TEST_SH} -c \
109			". ./h-f${f}; "'set -- ; delim_argv "$@"'
110		atf_check -s exit:0 -o inline:'>foobar<\n' -e empty \
111			${TEST_SH} -c \
112			". ./h-f${f}; "'set -- ; delim_argv "foo$@bar"'
113		atf_check -s exit:0 -o inline:'>foo  bar<\n' -e empty \
114			${TEST_SH} -c \
115			". ./h-f${f}; "'set -- ; delim_argv "foo $@ bar"'
116
117		atf_check -s exit:0 -o inline:'>a< >b< >c<\n' -e empty \
118			${TEST_SH} -c \
119			". ./h-f${f}; "'set -- a b c; delim_argv "$@"'
120		atf_check -s exit:0 -o inline:'>fooa< >b< >cbar<\n' -e empty \
121			${TEST_SH} -c \
122			". ./h-f${f}; "'set -- a b c; delim_argv "foo$@bar"'
123		atf_check -s exit:0 -o inline:'>foo a< >b< >c bar<\n' -e empty \
124			${TEST_SH} -c \
125			". ./h-f${f}; "'set -- a b c; delim_argv "foo $@ bar"'
126	done
127}
128
129atf_test_case strip
130strip_head() {
131	atf_set "descr" "Checks that the %% operator works and strips" \
132	                "the contents of a variable from the given point" \
133			"to the end"
134}
135strip_body() {
136	line='#define bindir "/usr/bin" /* comment */'
137	stripped='#define bindir "/usr/bin" '
138
139	# atf_expect_fail "PR bin/43469" -- now fixed
140	for exp in 				\
141		'${line%%/\**}'			\
142		'${line%%"/*"*}'		\
143		'${line%%'"'"'/*'"'"'*}'	\
144		'"${line%%/\**}"'		\
145		'"${line%%"/*"*}"'		\
146		'"${line%%'"'"'/*'"'"'*}"'	\
147		'${line%/\**}'			\
148		'${line%"/*"*}'			\
149		'${line%'"'"'/*'"'"'*}'		\
150		'"${line%/\**}"'		\
151		'"${line%"/*"*}"'		\
152		'"${line%'"'"'/*'"'"'*}"'
153	do
154		atf_check -o inline:":$stripped:\n" -e empty ${TEST_SH} -c \
155			"line='${line}'; echo :${exp}:"
156	done
157}
158
159atf_test_case wrap_strip
160wrap_strip_head() {
161	atf_set "descr" "Checks that the %% operator works and strips" \
162	                "the contents of a variable from the given point" \
163			'to the end, and that \ \n sequences do not break it'
164}
165wrap_strip_body() {
166	line='#define bindir "/usr/bin" /* comment */'
167	stripped='#define bindir "/usr/bin" '
168
169	for exp in 				\
170		'${line\
171%%/\**}'					\
172		'${line%%"/\
173*"*}'						\
174		'${line%%'"'"'/*'"'"'\
175*}'						\
176		'"${li\
177ne%%/\**}"'					\
178		'"${line%%"\
179/*"*}"'						\
180		'"${line%\
181%'"'"'/*'"'"'*}"'				\
182		'${line\
183%\
184/\*\
185*\
186}'						\
187		'${line%"/*\
188"*\
189}'						\
190		'${line\
191%\
192'"'"'/*'"'"'*}'					\
193		'"$\
194{li\
195ne%\
196'"'"'/*'"'"'*}"'
197	do
198		atf_check -o inline:":$stripped:\n" -e empty ${TEST_SH} -c \
199			"line='${line}'; echo :${exp}:"
200	done
201}
202
203atf_test_case varpattern_backslashes
204varpattern_backslashes_head() {
205	atf_set "descr" "Tests that protecting wildcards with backslashes" \
206	                "works in variable patterns."
207}
208varpattern_backslashes_body() {
209	line='/foo/bar/*/baz'
210	stripped='/foo/bar/'
211	atf_check -o inline:'/foo/bar/\n' -e empty ${TEST_SH} -c \
212		'line="/foo/bar/*/baz"; echo ${line%%\**}'
213}
214
215atf_test_case arithmetic
216arithmetic_head() {
217	atf_set "descr" "POSIX requires shell arithmetic to use signed" \
218	                "long or a wider type.  We use intmax_t, so at" \
219			"least 64 bits should be available.  Make sure" \
220			"this is true."
221}
222arithmetic_body() {
223
224	atf_check -o inline:'3' -e empty ${TEST_SH} -c \
225		'printf %s $((1 + 2))'
226	atf_check -o inline:'2147483647' -e empty ${TEST_SH} -c \
227		'printf %s $((0x7fffffff))'
228	atf_check -o inline:'9223372036854775807' -e empty ${TEST_SH} -c \
229		'printf %s $(((1 << 63) - 1))'
230}
231
232atf_test_case iteration_on_null_parameter
233iteration_on_null_parameter_head() {
234	atf_set "descr" "Check iteration of \$@ in for loop when set to null;" \
235	                "the error \"sh: @: parameter not set\" is incorrect." \
236	                "PR bin/48202."
237}
238iteration_on_null_parameter_body() {
239	atf_check -o empty -e empty ${TEST_SH} -c \
240		'N=; set -- ${N};   for X; do echo "[$X]"; done'
241}
242
243atf_test_case iteration_on_quoted_null_parameter
244iteration_on_quoted_null_parameter_head() {
245	atf_set "descr" \
246		'Check iteration of "$@" in for loop when set to null;'
247}
248iteration_on_quoted_null_parameter_body() {
249	atf_check -o inline:'[]\n' -e empty ${TEST_SH} -c \
250		'N=; set -- "${N}"; for X; do echo "[$X]"; done'
251}
252
253atf_test_case iteration_on_null_or_null_parameter
254iteration_on_null_or_null_parameter_head() {
255	atf_set "descr" \
256		'Check expansion of null parameter as default for another null'
257}
258iteration_on_null_or_null_parameter_body() {
259	atf_check -o empty -e empty ${TEST_SH} -c \
260		'N=; E=; set -- ${N:-${E}}; for X; do echo "[$X]"; done'
261}
262
263atf_test_case iteration_on_null_or_missing_parameter
264iteration_on_null_or_missing_parameter_head() {
265	atf_set "descr" \
266	    'Check expansion of missing parameter as default for another null'
267}
268iteration_on_null_or_missing_parameter_body() {
269	# atf_expect_fail 'PR bin/50834'
270	atf_check -o empty -e empty ${TEST_SH} -c \
271		'N=; set -- ${N:-}; for X; do echo "[$X]"; done'
272}
273
274####### The remaining tests use the following helper functions ...
275
276nl='
277'
278reset()
279{
280	TEST_NUM=0
281	TEST_FAILURES=''
282	TEST_FAIL_COUNT=0
283	TEST_ID="$1"
284}
285
286check()
287{
288	fail=false
289	TEMP_FILE=$( mktemp OUT.XXXXXX )
290	TEST_NUM=$(( $TEST_NUM + 1 ))
291	MSG=
292
293	# our local shell (ATF_SHELL) better do quoting correctly...
294	# some of the tests expect us to expand $nl internally...
295	CMD="$1"
296
297	result="$( ${TEST_SH} -c "${CMD}" 2>"${TEMP_FILE}" )"
298	STATUS=$?
299
300	if [ "${STATUS}" -ne "$3" ]; then
301		MSG="${MSG}${MSG:+${nl}}[$TEST_NUM]"
302		MSG="${MSG} expected exit code $3, got ${STATUS}"
303
304		# don't actually fail just because of wrong exit code
305		# unless we either expected, or received "good"
306		# or something else is detected as incorrect as well.
307		case "$3/${STATUS}" in
308		(*/0|0/*) fail=true;;
309		esac
310	fi
311
312	if [ "$3" -eq 0 ]; then
313		if [ -s "${TEMP_FILE}" ]; then
314			MSG="${MSG}${MSG:+${nl}}[$TEST_NUM]"
315			MSG="${MSG} Messages produced on stderr unexpected..."
316			MSG="${MSG}${nl}$( cat "${TEMP_FILE}" )"
317			fail=true
318		fi
319	else
320		if ! [ -s "${TEMP_FILE}" ]; then
321			MSG="${MSG}${MSG:+${nl}}[$TEST_NUM]"
322			MSG="${MSG} Expected messages on stderr,"
323			MSG="${MSG} nothing produced"
324			fail=true
325		fi
326	fi
327	rm -f "${TEMP_FILE}"
328
329	# Remove newlines (use local shell for this)
330	oifs="$IFS"
331	IFS="$nl"
332	result="$(echo $result)"
333	IFS="$oifs"
334	if [ "$2" != "$result" ]
335	then
336		MSG="${MSG}${MSG:+${nl}}[$TEST_NUM]"
337		MSG="${MSG} Expected output '$2', received '$result'"
338		fail=true
339	fi
340
341	if $fail
342	then
343		MSG="${MSG}${MSG:+${nl}}[$TEST_NUM]"
344		MSG="${MSG} Full command: <<${CMD}>>"
345	fi
346
347	$fail && test -n "$TEST_ID" && {
348		TEST_FAILURES="${TEST_FAILURES}${TEST_FAILURES:+${nl}}"
349		TEST_FAILURES="${TEST_FAILURES}${TEST_ID}[$TEST_NUM]:"
350		TEST_FAILURES="${TEST_FAILURES} Test of '$1' failed.";
351		TEST_FAILURES="${TEST_FAILURES}${nl}${MSG}"
352		TEST_FAIL_COUNT=$(( $TEST_FAIL_COUNT + 1 ))
353		return 0
354	}
355	$fail && atf_fail "Test[$TEST_NUM] failed: $(
356	    # ATF does not like newlines in messages, so change them...
357		    printf '%s' "${MSG}" | tr '\n' ';'
358	    )"
359	return 0
360}
361
362results()
363{
364	test -n "$1" && atf_expect_fail "$1"
365
366	test -z "${TEST_ID}" && return 0
367	test -z "${TEST_FAILURES}" && return 0
368
369	echo >&2 "=========================================="
370	echo >&2 "While testing '${TEST_ID}'"
371	echo >&2 " - - - - - - - - - - - - - - - - -"
372	echo >&2 "${TEST_FAILURES}"
373
374	atf_fail \
375 "Test ${TEST_ID}: $TEST_FAIL_COUNT (of $TEST_NUM) subtests failed - see stderr"
376}
377
378####### End helpers
379
380atf_test_case shell_params
381shell_params_head() {
382	atf_set "descr" "Test correct operation of the numeric parameters"
383}
384shell_params_body() {
385	atf_require_prog mktemp
386
387	reset shell_params
388
389	check 'set -- a b c; echo "$#: $1 $2 $3"' '3: a b c' 0
390	check 'set -- a b c d e f g h i j k l m; echo "$#: ${1}0 ${10} $10"' \
391		'13: a0 j a0' 0
392	check 'x="$0"; set -- a b; y="$0";
393	      [ "x${x}y" = "x${y}y" ] && echo OK || echo x="$x" y="$y"' \
394		'OK' 0
395	check "${TEST_SH} -c 'echo 0=\$0 1=\$1 2=\$2' a b c" '0=a 1=b 2=c' 0
396
397	echo 'echo 0="$0" 1="$1" 2="$2"' > helper.sh
398	check "${TEST_SH} helper.sh a b c" '0=helper.sh 1=a 2=b' 0
399
400	check 'set -- a bb ccc dddd eeeee ffffff ggggggg hhhhhhhh \
401		iiiiiiiii jjjjjjjjjj kkkkkkkkkkk
402	       echo "${#}: ${#1} ${#2} ${#3} ${#4} ... ${#9} ${#10} ${#11}"' \
403		 '11: 1 2 3 4 ... 9 10 11' 0
404
405	check 'set -- a b c; echo "$#: ${1-A} ${2-B} ${3-C} ${4-D} ${5-E}"' \
406		'3: a b c D E' 0
407	check 'set -- a "" c "" e
408	       echo "$#: ${1:-A} ${2:-B} ${3:-C} ${4:-D} ${5:-E}"' \
409		'5: a B c D e' 0
410	check 'set -- a "" c "" e
411	       echo "$#: ${1:+A} ${2:+B} ${3:+C} ${4:+D} ${5:+E}"' \
412		'5: A  C  E' 0
413	check 'set -- "abab*cbb"
414	       echo "${1} ${1#a} ${1%b} ${1##ab} ${1%%b} ${1#*\*} ${1%\**}"' \
415	       'abab*cbb bab*cbb abab*cb ab*cbb abab*cb cbb abab' 0
416	check 'set -- "abab?cbb"
417    echo "${1}:${1#*a}+${1%b*}-${1##*a}_${1%%b*}%${1#[ab]}=${1%?*}/${1%\?*}"' \
418	       'abab?cbb:bab?cbb+abab?cb-b?cbb_a%bab?cbb=abab?cb/abab' 0
419	check 'set -- a "" c "" e; echo "${2:=b}"' '' 1
420
421	check 'set -- a b c d; echo ${4294967297}' '' 0  # result 'a' => ${1}
422	check 'set -- a b c; echo ${01}' 'a' 0
423	check "${TEST_SH} -c 'echo 0=\${00} 1=\${01} 2=\${02}' a b c" \
424			'0=a 1=b 2=c' 0
425
426	# by special request, for PaulG...  (${0...} is not octal!)
427
428	# Posix XCU 2.5.1 (Issue 7 TC2 pg 2349 lines 74835..6):
429	#   The digits denoting the positional parameters shall always
430	#   be interpreted as a decimal value, even if there is a leading zero.
431
432	check \
433	    'set -- a b c d e f g h i j k l m; echo "$#: ${08} ${010} ${011}"' \
434		'13: h j k' 0
435
436	results
437}
438
439atf_test_case var_with_embedded_cmdsub
440var_with_embedded_cmdsub_head() {
441	atf_set "descr" "Test expansion of vars with embedded cmdsub"
442}
443var_with_embedded_cmdsub_body() {
444
445	reset var_with_embedded_cmdsub
446
447	check 'unset x; echo ${x-$(echo a)}$(echo b)'  'ab' 0	#1
448	check 'unset x; echo ${x:-$(echo a)}$(echo b)' 'ab' 0	#2
449	check 'x=""; echo ${x-$(echo a)}$(echo b)'     'b'  0	#3
450	check 'x=""; echo ${x:-$(echo a)}$(echo b)'    'ab' 0	#4
451	check 'x=c; echo ${x-$(echo a)}$(echo b)'      'cb' 0	#5
452	check 'x=c; echo ${x:-$(echo a)}$(echo b)'     'cb' 0	#6
453
454	check 'unset x; echo ${x+$(echo a)}$(echo b)'  'b'  0	#7
455	check 'unset x; echo ${x:+$(echo a)}$(echo b)' 'b'  0	#8
456	check 'x=""; echo ${x+$(echo a)}$(echo b)'     'ab' 0	#9
457	check 'x=""; echo ${x:+$(echo a)}$(echo b)'    'b'  0	#10
458	check 'x=c; echo ${x+$(echo a)}$(echo b)'      'ab' 0	#11
459	check 'x=c; echo ${x:+$(echo a)}$(echo b)'     'ab' 0	#12
460
461	check 'unset x; echo ${x=$(echo a)}$(echo b)'  'ab' 0	#13
462	check 'unset x; echo ${x:=$(echo a)}$(echo b)' 'ab' 0	#14
463	check 'x=""; echo ${x=$(echo a)}$(echo b)'     'b'  0	#15
464	check 'x=""; echo ${x:=$(echo a)}$(echo b)'    'ab' 0	#16
465	check 'x=c; echo ${x=$(echo a)}$(echo b)'      'cb' 0	#17
466	check 'x=c; echo ${x:=$(echo a)}$(echo b)'     'cb' 0	#18
467
468	check 'unset x; echo ${x?$(echo a)}$(echo b)'  ''   2	#19
469	check 'unset x; echo ${x:?$(echo a)}$(echo b)' ''   2	#20
470	check 'x=""; echo ${x?$(echo a)}$(echo b)'     'b'  0	#21
471	check 'x=""; echo ${x:?$(echo a)}$(echo b)'    ''   2	#22
472	check 'x=c; echo ${x?$(echo a)}$(echo b)'      'cb' 0	#23
473	check 'x=c; echo ${x:?$(echo a)}$(echo b)'     'cb' 0	#24
474
475	check 'unset x; echo ${x%$(echo a)}$(echo b)'  'b'  0	#25
476	check 'unset x; echo ${x%%$(echo a)}$(echo b)' 'b'  0	#26
477	check 'x=""; echo ${x%$(echo a)}$(echo b)'     'b'  0	#27
478	check 'x=""; echo ${x%%$(echo a)}$(echo b)'    'b'  0	#28
479	check 'x=c; echo ${x%$(echo a)}$(echo b)'      'cb' 0	#29
480	check 'x=c; echo ${x%%$(echo a)}$(echo b)'     'cb' 0	#30
481	check 'x=aa; echo ${x%$(echo "*a")}$(echo b)'  'ab' 0	#31
482	check 'x=aa; echo ${x%%$(echo "*a")}$(echo b)' 'b'  0	#32
483
484	check 'unset x; echo ${x#$(echo a)}$(echo b)'  'b'  0	#33
485	check 'unset x; echo ${x##$(echo a)}$(echo b)' 'b'  0	#34
486	check 'x=""; echo ${x#$(echo a)}$(echo b)'     'b'  0	#35
487	check 'x=""; echo ${x##$(echo a)}$(echo b)'    'b'  0	#36
488	check 'x=c; echo ${x#$(echo a)}$(echo b)'      'cb' 0	#37
489	check 'x=c; echo ${x##$(echo a)}$(echo b)'     'cb' 0	#38
490	check 'x=aa; echo ${x#$(echo "*a")}$(echo b)'  'ab' 0	#39
491	check 'x=aa; echo ${x##$(echo "*a")}$(echo b)' 'b'  0	#40
492
493	results
494}
495
496atf_test_case dollar_hash
497dollar_hash_head() {
498	atf_set "descr" 'Test expansion of various aspects of $#'
499}
500dollar_hash_body() {
501
502#
503#	$# looks like it should be so simple that it doesn't really
504#	need a test of its own, and used in that way, it really doesn't.
505#	But when we add braces ${#} we need to deal with the three
506#	(almost 4) different meanings of a # inside a ${} expansion...
507#
508#	Note that some of these are just how we treat expansions that
509#	are unspecified by posix (as noted below.)
510#
511#		1.   ${#} is just $# (number of params)
512#		1.a	${\#} is nothing at all (error: invalid expansion)
513#		1.b	${\#...} (anything after) is the same (invalid)
514#		2.   ${#VAR} is the length of the value VAR
515#		2.a	Including ${##} - the length of ${#}
516#		3    ${VAR#pat} is the value of VAR with leading pat removed
517#		3.a	Including ${VAR#} which just removes leading nothing
518#			This is relevant in case of ${VAR#${X}} with X=''
519#				nb: not required by posix, see XCU 2.6.2
520#		3.b	${##} is not a case of 3.a but rather 2.a
521#		3.c	Yet ${##pat} is a case of 3.a
522#			Including ${##${X}} where X='' or X='#'
523#				nb: not required by posix, see XCU 2.6.2
524#		3.d	And ${#\#} is invalid (error)
525#		3.e	But ${##\#} removes a leading # from the value of $#
526#			(so is just $# as there is no leading # there)
527#				nb: not required by posix, see XCU 2.6.2
528#		4    ${VAR##pat} is the value of VAR with longest pat removed
529#		4.a	Including ${VAR##} which removes the longest nothing
530#		4.b	Which in this case includes ${###} (so is == $#)
531#				nb: not required by posix, see XCU 2.6.2
532#		4.c	But not ${##\#} which is $# with a leading '#' removed
533#			(and so is also == $#), i.e.: like ${###} but different.
534#				nb: not required by posix, see XCU 2.6.2
535#		4.d	As is ${###\#} or just ${####} - remove  # (so just $#)
536#				nb: not required by posix, see XCU 2.6.2
537#
538
539	reset dollar_hash
540
541	check 'set -- ; echo $#'			'0'		0  # 1
542	check 'set -- a b c; echo $#'			'3'		0  # 2
543	check 'set -- a b c d e f g h i j; echo $#'	'10'		0  # 3
544# rule 1
545	check 'set -- ; echo ${#}'			'0'		0  # 4
546	check 'set -- a b c; echo ${#}'			'3'		0  # 5
547	check 'set -- a b c d e f g h i j; echo ${#}'	'10'		0  # 6
548# rule 1.a
549	check 'set -- a b c; echo ${\#}'		''		2  # 7
550# rule 1.b
551	check 'set -- a b c; echo ${\#:-foo}'		''		2  # 8
552# rule 2
553	check 'VAR=12345; echo ${#VAR}'			'5'		0  # 9
554	check 'VAR=123456789012; echo ${#VAR}'		'12'		0  #10
555# rule 2.a
556	check 'set -- ; echo ${##}'			'1'		0  #11
557	check 'set -- a b c; echo ${##}'		'1'		0  #12
558	check 'set -- a b c d e f g h i j; echo ${##}'	'2'		0  #13
559# rule 3
560	check 'VAR=12345; echo ${VAR#1}'		'2345'		0  #14
561	check 'VAR=12345; echo ${VAR#2}'		'12345'		0  #15
562	check 'VAR=#2345; echo ${VAR#\#}'		'2345'		0  #16
563	check 'X=1; VAR=12345; echo ${VAR#${X}}'	'2345'		0  #17
564	check 'X=1; VAR=#2345; echo ${VAR#${X}}'	'#2345'		0  #18
565# rule 3.a
566	check 'VAR=12345; echo ${VAR#}'			'12345'		0  #19
567	check 'X=; VAR=12345; echo ${VAR#${X}}'		'12345'		0  #20
568# rule 3.b (tested above, rule 2.a)
569# rule 3.c
570	check 'set -- ; echo ${##0}'			''		0  #21
571	check 'set -- a b c; echo ${##1}'		'3'		0  #22
572	check 'set -- a b c d e f g h i j; echo ${##1}'	'0'		0  #23
573	check 'X=0; set -- ; echo ${##${X}}'		''		0  #24
574	check 'X=; set -- ; echo ${##${X}}'		'0'		0  #25
575	check 'X=1; set -- a b c; echo ${##${X}}'	'3'		0  #26
576	check 'X=1; set -- a b c d e f g h i j; echo ${##${X}}'	'0'	0  #27
577	check 'X=; set -- a b c d e f g h i j; echo ${##${X}}'	'10'	0  #28
578	check 'X=#; VAR=#2345; echo ${VAR#${X}}'	'2345'		0  #29
579	check 'X=#; VAR=12345; echo ${VAR#${X}}'	'12345'		0  #30
580# rule 3.d
581	check 'set -- a b c; echo ${#\#}'		''		2  #31
582# rule 3.e
583	check 'set -- ; echo ${##\#}'			'0'		0  #32
584	check 'set -- a b c d e f g h i j; echo ${##\#}' '10'		0  #33
585
586# rule 4
587	check 'VAR=12345; echo ${VAR##1}'		'2345'		0  #34
588	check 'VAR=12345; echo ${VAR##\1}'		'2345'		0  #35
589# rule 4.a
590	check 'VAR=12345; echo ${VAR##}'		'12345'		0  #36
591# rule 4.b
592	check 'set -- ; echo ${###}'			'0'		0  #37
593	check 'set -- a b c d e f g h i j; echo ${###}'	'10'		0  #38
594# rule 4.c
595	check 'VAR=12345; echo ${VAR#\#}'		'12345'		0  #39
596	check 'VAR=12345; echo ${VAR#\#1}'		'12345'		0  #40
597	check 'VAR=#2345; echo ${VAR#\#}'		'2345'		0  #41
598	check 'VAR=#12345; echo ${VAR#\#1}'		'2345'		0  #42
599	check 'VAR=#2345; echo ${VAR#\#1}'		'#2345'		0  #43
600	check 'set -- ; echo ${####}'			'0'		0  #44
601	check 'set -- ; echo ${###\#}'			'0'		0  #45
602	check 'set -- a b c d e f g h i j; echo ${####}' '10'		0  #46
603	check 'set -- a b c d e f g h i j; echo ${###\#}' '10'		0  #47
604
605# now check for some more utter nonsense, not mentioned in the rules
606# above (doesn't need to be)
607
608	check 'x=hello; set -- a b c; echo ${#x:-1}'	''		2  #48
609	check 'x=hello; set -- a b c; echo ${#x-1}'	''		2  #49
610	check 'x=hello; set -- a b c; echo ${#x:+1}'	''		2  #50
611	check 'x=hello; set -- a b c; echo ${#x+1}'	''		2  #51
612	check 'x=hello; set -- a b c; echo ${#x+1}'	''		2  #52
613	check 'x=hello; set -- a b c; echo ${#x:?msg}'	''		2  #53
614	check 'x=hello; set -- a b c; echo ${#x?msg}'	''		2  #54
615	check 'x=hello; set -- a b c; echo ${#x:=val}'	''		2  #55
616	check 'x=hello; set -- a b c; echo ${#x=val}'	''		2  #56
617	check 'x=hello; set -- a b c; echo ${#x#h}'	''		2  #57
618	check 'x=hello; set -- a b c; echo ${#x#*l}'	''		2  #58
619	check 'x=hello; set -- a b c; echo ${#x##*l}'	''		2  #59
620	check 'x=hello; set -- a b c; echo ${#x%o}'	''		2  #60
621	check 'x=hello; set -- a b c; echo ${#x%l*}'	''		2  #61
622	check 'x=hello; set -- a b c; echo ${#x%%l*}'	''		2  #62
623
624# but just to be complete, these ones should work
625
626	check 'x=hello; set -- a b c; echo ${#%5}'	'3'		0  #63
627	check 'x=hello; set -- a b c; echo ${#%3}'	''		0  #64
628	check 'x=hello; set -- a b c; echo ${#%?}'	''		0  #65
629	check 'X=#; set -- a b c; echo ${#%${X}}'	'3'		0  #66
630	check 'X=3; set -- a b c; echo ${#%${X}}'	''		0  #67
631	check 'set -- a b c; echo ${#%%5}'		'3'		0  #68
632	check 'set -- a b c; echo ${#%%3}'		''		0  #69
633	check 'set -- a b c d e f g h i j k l; echo ${#%1}' '12'	0  #70
634	check 'set -- a b c d e f g h i j k l; echo ${#%2}' '1'		0  #71
635	check 'set -- a b c d e f g h i j k l; echo ${#%?}' '1'		0  #72
636	check 'set -- a b c d e f g h i j k l; echo ${#%[012]}' '1'	0  #73
637	check 'set -- a b c d e f g h i j k l; echo ${#%[0-4]}' '1'	0  #74
638	check 'set -- a b c d e f g h i j k l; echo ${#%?2}' ''		0  #75
639	check 'set -- a b c d e f g h i j k l; echo ${#%1*}' ''		0  #76
640	check 'set -- a b c d e f g h i j k l; echo ${#%%2}' '1'	0  #77
641	check 'set -- a b c d e f g h i j k l; echo ${#%%1*}' ''	0  #78
642
643# and this lot are stupid, as $# is never unset or null, but they do work...
644
645	check 'set -- a b c; echo ${#:-99}'		'3'		0  #79
646	check 'set -- a b c; echo ${#-99}'		'3'		0  #80
647	check 'set -- a b c; echo ${#:+99}'		'99'		0  #81
648	check 'set -- a b c; echo ${#+99}'		'99'		0  #82
649	check 'set -- a b c; echo ${#:?bogus}'		'3'		0  #83
650	check 'set -- a b c; echo ${#?bogus}'		'3'		0  #84
651
652# even this utter nonsense is OK, as while special params cannot be
653# set this way, here, as $# is not unset, or null, the assignment
654# never happens (isn't even attempted)
655
656	check 'set -- a b c; echo ${#:=bogus}'		'3'		0  #85
657	check 'set -- a b c; echo ${#=bogus}'		'3'		0  #86
658
659	for n in 0 1 10 25 100				#87 #88 #89 #90 #91
660	do
661		check "(exit $n)"'; echo ${#?}'		"${#n}"		0
662	done
663
664	results		# results so far anyway...
665
666# now we have some harder to verify cases, as they (must) check unknown values
667# and hence the resuls cannot just be built into the script, but we have
668# to use some tricks to validate them, so for these, just do regular testing
669# and don't attempt to use the check helper function, nor to include
670# these tests in the result summary.   If anything has already failed, we
671# do not get this far...   From here on, first failure ends this test.
672
673	for opts in '' '-a' '-au' '-auf' '-aufe' # options safe enough to set
674	do
675		# Note the shell might have other (or these) opts set already
676
677		RES=$(${TEST_SH} -c "test -n '${opts}' && set ${opts};
678			printf '%s' \"\$-\";printf ' %s\\n' \"\${#-}\"") ||
679			atf_fail '${#-} test exited with status '"$?"
680		LEN="${RES##* }"
681		DMINUS="${RES% ${LEN}}"
682		if [ "${#DMINUS}" != "${LEN}" ]
683		then
684			atf_fail \
685		   '${#-} test'" produced ${LEN} for opts ${DMINUS} (${RES})"
686		fi
687	done
688
689	for seq in a b c d e f g h i j
690	do
691		# now we are tryin to generate different pids for $$ and $!
692		# so we just run the test a number of times, and hope...
693		# On NetBSD pid randomisation will usually help the tests
694
695		eval "$(${TEST_SH} -c \
696		    '(exit 0)& BG=$! LBG=${#!};
697	    printf "SH=%s BG=%s LSH=%s LBG=%s" "$$" "$BG" "${#$}" "$LBG";
698		      wait')"
699
700		if [ "${#SH}" != "${LSH}" ] || [ "${#BG}" != "${LBG}" ]
701		then
702			atf_fail \
703	'${#!] of '"${BG} was ${LBG}, expected ${#BG}"'; ${#$} of '"${SH} was ${LSH}, expected ${#SH}"
704		fi
705	done
706}
707
708atf_test_case dollar_star
709dollar_star_head() {
710	atf_set "descr" 'Test expansion of various aspects of $*'
711}
712dollar_star_body() {
713
714	reset dollar_star
715
716	check 'set -- a b c; echo $# $*'		'3 a b c'	0  # 1
717	check 'set -- a b c; echo $# "$*"'		'3 a b c'	0  # 2
718	check 'set -- a "b c"; echo $# $*'		'2 a b c'	0  # 3
719	check 'set -- a "b c"; echo $# "$*"'		'2 a b c'	0  # 4
720	check 'set -- a b c; set -- $* ; echo $# $*'	'3 a b c'	0  # 5
721	check 'set -- a b c; set -- "$*" ; echo $# $*'	'1 a b c'	0  # 6
722	check 'set -- a "b c"; set -- $* ; echo $# $*'	'3 a b c'	0  # 7
723	check 'set -- a "b c"; set -- "$*" ; echo $# $*' \
724							'1 a b c'	0  # 8
725
726	check 'IFS=". "; set -- a b c; echo $# $*'	'3 a b c'	0  # 9
727	check 'IFS=". "; set -- a b c; echo $# "$*"'	'3 a.b.c'	0  #10
728	check 'IFS=". "; set -- a "b c"; echo $# $*'	'2 a b c'	0  #11
729	check 'IFS=". "; set -- a "b c"; echo $# "$*"'	'2 a.b c'	0  #12
730	check 'IFS=". "; set -- a "b.c"; echo $# $*'	'2 a b c'	0  #13
731	check 'IFS=". "; set -- a "b.c"; echo $# "$*"'	'2 a.b.c'	0  #14
732	check 'IFS=". "; set -- a b c; set -- $* ; echo $# $*' \
733							'3 a b c'	0  #15
734	check 'IFS=". "; set -- a b c; set -- "$*" ; echo $# $*' \
735							'1 a b c'	0  #16
736	check 'IFS=". "; set -- a "b c"; set -- $* ; echo $# $*' \
737							'3 a b c'	0  #17
738	check 'IFS=". "; set -- a "b c"; set -- "$*" ; echo $# $*' \
739							'1 a b c'	0  #18
740	check 'IFS=". "; set -- a b c; set -- $* ; echo $# "$*"' \
741							'3 a.b.c'	0  #19
742	check 'IFS=". "; set -- a b c; set -- "$*" ; echo $# "$*"' \
743							'1 a.b.c'	0  #20
744	check 'IFS=". "; set -- a "b c"; set -- $* ; echo $# "$*"' \
745							'3 a.b.c'	0  #21
746	check 'IFS=". "; set -- a "b c"; set -- "$*" ; echo $# "$*"' \
747							'1 a.b c'	0  #22
748
749	results
750}
751
752atf_test_case dollar_star_in_word
753dollar_star_in_word_head() {
754	atf_set "descr" 'Test expansion $* occurring in word of ${var:-word}'
755}
756dollar_star_in_word_body() {
757
758	reset dollar_star_in_word
759
760	unset xXx			; # just in case!
761
762	# Note that the expected results for these tests are identical
763	# to those from the dollar_star test.   It should never make
764	# a difference whether we expand $* or ${unset:-$*}
765
766	# (note expanding ${unset:-"$*"} is different, that is not tested here)
767
768	check 'set -- a b c; echo $# ${xXx:-$*}'		'3 a b c' 0  # 1
769	check 'set -- a b c; echo $# "${xXx:-$*}"'		'3 a b c' 0  # 2
770	check 'set -- a "b c"; echo $# ${xXx:-$*}'		'2 a b c' 0  # 3
771	check 'set -- a "b c"; echo $# "${xXx:-$*}"'		'2 a b c' 0  # 4
772	check 'set -- a b c; set -- ${xXx:-$*} ; echo $# $*'	'3 a b c' 0  # 5
773	check 'set -- a b c; set -- "${xXx:-$*}" ; echo $# $*'	'1 a b c' 0  # 6
774	check 'set -- a "b c"; set -- ${xXx:-$*} ; echo $# $*'	'3 a b c' 0  # 7
775	check 'set -- a "b c"; set -- "${xXx:-$*}" ; echo $# $*' \
776								'1 a b c' 0  # 8
777
778	check 'IFS=". "; set -- a b c; echo $# ${xXx:-$*}'	'3 a b c' 0  # 9
779	check 'IFS=". "; set -- a b c; echo $# "${xXx:-$*}"'	'3 a.b.c' 0  #10
780	check 'IFS=". "; set -- a "b c"; echo $# ${xXx:-$*}'	'2 a b c' 0  #11
781	check 'IFS=". "; set -- a "b c"; echo $# "${xXx:-$*}"'	'2 a.b c' 0  #12
782	check 'IFS=". "; set -- a "b.c"; echo $# ${xXx:-$*}'	'2 a b c' 0  #13
783	check 'IFS=". "; set -- a "b.c"; echo $# "${xXx:-$*}"'	'2 a.b.c' 0  #14
784	check 'IFS=". ";set -- a b c;set -- ${xXx:-$*};echo $# ${xXx:-$*}' \
785								'3 a b c' 0  #15
786	check 'IFS=". ";set -- a b c;set -- "${xXx:-$*}";echo $# ${xXx:-$*}' \
787								'1 a b c' 0  #16
788	check 'IFS=". ";set -- a "b c";set -- ${xXx:-$*};echo $# ${xXx:-$*}' \
789								'3 a b c' 0  #17
790	check 'IFS=". ";set -- a "b c";set -- "${xXx:-$*}";echo $# ${xXx:-$*}' \
791								'1 a b c' 0  #18
792	check 'IFS=". ";set -- a b c;set -- ${xXx:-$*};echo $# "${xXx:-$*}"' \
793								'3 a.b.c' 0  #19
794	check 'IFS=". ";set -- a b c;set -- "$*";echo $# "$*"' \
795								'1 a.b.c' 0  #20
796	check 'IFS=". ";set -- a "b c";set -- $*;echo $# "$*"' \
797								'3 a.b.c' 0  #21
798	check 'IFS=". ";set -- a "b c";set -- "$*";echo $# "$*"' \
799								'1 a.b c' 0  #22
800
801	results
802}
803
804atf_test_case dollar_star_with_empty_ifs
805dollar_star_with_empty_ifs_head() {
806	atf_set "descr" 'Test expansion of $* with IFS=""'
807}
808dollar_star_with_empty_ifs_body() {
809
810	reset dollar_star_with_empty_ifs
811
812	check 'IFS=""; set -- a b c; echo $# $*'	'3 a b c'	0  # 1
813	check 'IFS=""; set -- a b c; echo $# "$*"'	'3 abc'		0  # 2
814	check 'IFS=""; set -- a "b c"; echo $# $*'	'2 a b c'	0  # 3
815	check 'IFS=""; set -- a "b c"; echo $# "$*"'	'2 ab c'	0  # 4
816	check 'IFS=""; set -- a "b.c"; echo $# $*'	'2 a b.c'	0  # 5
817	check 'IFS=""; set -- a "b.c"; echo $# "$*"'	'2 ab.c'	0  # 6
818	check 'IFS=""; set -- a b c; set -- $* ; echo $# $*' \
819							'3 a b c'	0  # 7
820	check 'IFS=""; set -- a b c; set -- "$*" ; echo $# $*' \
821							'1 abc'		0  # 8
822	check 'IFS=""; set -- a "b c"; set -- $* ; echo $# $*' \
823							'2 a b c'	0  # 9
824	check 'IFS=""; set -- a "b c"; set -- "$*" ; echo $# $*' \
825							'1 ab c'	0  #10
826	check 'IFS=""; set -- a b c; set -- $* ; echo $# "$*"' \
827							'3 abc'		0  #11
828	check 'IFS=""; set -- a b c; set -- "$*" ; echo $# "$*"' \
829							'1 abc'		0  #12
830	check 'IFS=""; set -- a "b c"; set -- $* ; echo $# "$*"' \
831							'2 ab c'	0  #13
832	check 'IFS=""; set -- a "b c"; set -- "$*" ; echo $# "$*"' \
833							'1 ab c'	0  #14
834
835	results	  # FIXED: 'PR bin/52090 expect 7 of 14 subtests to fail'
836}
837
838atf_test_case dollar_star_in_word_empty_ifs
839dollar_star_in_word_empty_ifs_head() {
840	atf_set "descr" 'Test expansion of ${unset:-$*} with IFS=""'
841}
842dollar_star_in_word_empty_ifs_body() {
843
844	reset dollar_star_in_word_empty_ifs
845
846	unset xXx			; # just in case
847
848	# Note that the expected results for these tests are identical
849	# to those from the dollar_star_with_empty_ifs test.   It should
850	# never make a difference whether we expand $* or ${unset:-$*}
851
852	# (note expanding ${unset:-"$*"} is different, that is not tested here)
853
854	check 'IFS="";set -- a b c;echo $# ${xXx:-$*}'		'3 a b c' 0  # 1
855	check 'IFS="";set -- a b c;echo $# "${xXx:-$*}"'	'3 abc'	  0  # 2
856	check 'IFS="";set -- a "b c";echo $# ${xXx:-$*}'	'2 a b c' 0  # 3
857	check 'IFS="";set -- a "b c";echo $# "${xXx:-$*}"'	'2 ab c'  0  # 4
858	check 'IFS="";set -- a "b.c";echo $# ${xXx:-$*}'	'2 a b.c' 0  # 5
859	check 'IFS="";set -- a "b.c";echo $# "${xXx:-$*}"'	'2 ab.c'  0  # 6
860	check 'IFS="";set -- a b c;set -- ${xXx:-$*};echo $# ${xXx:-$*}' \
861								'3 a b c' 0  # 7
862	check 'IFS="";set -- a b c;set -- "${xXx:-$*}";echo $# ${xXx:-$*}' \
863								'1 abc'   0  # 8
864	check 'IFS="";set -- a "b c";set -- ${xXx:-$*};echo $# ${xXx:-$*}' \
865								'2 a b c' 0  # 9
866	check 'IFS="";set -- a "b c";set -- "${xXx:-$*}";echo $# ${xXx:-$*}' \
867								'1 ab c'  0  #10
868	check 'IFS="";set -- a b c;set -- ${xXx:-$*};echo $# "${xXx:-$*}"' \
869								'3 abc'	  0  #11
870	check 'IFS="";set -- a b c;set -- "${xXx:-$*}";echo $# "${xXx:-$*}"' \
871								'1 abc'	  0  #12
872	check 'IFS="";set -- a "b c";set -- ${xXx:-$*};echo $# "${xXx:-$*}"' \
873								'2 ab c'  0  #13
874	check 'IFS="";set -- a "b c";set -- "${xXx:-$*}";echo $# "${xXx:-$*}"' \
875								'1 ab c'  0  #14
876
877	results	  # FIXED: 'PR bin/52090 expect 7 of 14 subtests to fail'
878}
879
880atf_test_case dollar_star_in_quoted_word
881dollar_star_in_quoted_word_head() {
882	atf_set "descr" 'Test expansion $* occurring in word of ${var:-"word"}'
883}
884dollar_star_in_quoted_word_body() {
885
886	reset dollar_star_in_quoted_word
887
888	unset xXx			; # just in case!
889
890	check 'set -- a b c; echo $# ${xXx:-"$*"}'		'3 a b c' 0  # 1
891	check 'set -- a "b c"; echo $# ${xXx:-"$*"}'		'2 a b c' 0  # 2
892	check 'set -- a b c; set -- ${xXx:-"$*"} ; echo $# ${xXx-"$*"}' \
893								'1 a b c' 0  # 3
894	check 'set -- a "b c"; set -- ${xXx:-"$*"} ; echo $# ${xXx-"$*"}' \
895								'1 a b c' 0  # 4
896	check 'set -- a b c; set -- ${xXx:-"$*"} ; echo $# ${xXx-"$*"}' \
897								'1 a b c' 0  # 5
898	check 'set -- a "b c"; set -- ${xXx:-"$*"} ; echo $# ${xXx-$*}' \
899								'1 a b c' 0  # 6
900	check 'set -- a b c; set -- ${xXx:-$*} ; echo $# ${xXx-"$*"}' \
901								'3 a b c' 0  # 7
902	check 'set -- a "b c"; set -- ${xXx:-$*} ; echo $# ${xXx-"$*"}' \
903								'3 a b c' 0  # 8
904
905	check 'IFS=". "; set -- a b c; echo $# ${xXx:-"$*"}'	'3 a.b.c' 0  # 9
906	check 'IFS=". "; set -- a "b c"; echo $# ${xXx:-"$*"}'	'2 a.b c' 0  #10
907	check 'IFS=". "; set -- a "b.c"; echo $# ${xXx:-"$*"}'	'2 a.b.c' 0  #11
908	check 'IFS=". ";set -- a b c;set -- ${xXx:-"$*"};echo $# ${xXx:-"$*"}' \
909								'1 a.b.c' 0  #12
910      check 'IFS=". ";set -- a "b c";set -- ${xXx:-"$*"};echo $# ${xXx:-"$*"}' \
911								'1 a.b c' 0  #13
912	check 'IFS=". ";set -- a b c;set -- ${xXx:-$*};echo $# ${xXx:-"$*"}' \
913								'3 a.b.c' 0  #14
914	check 'IFS=". ";set -- a "b c";set -- ${xXx:-$*};echo $# ${xXx:-"$*"}' \
915								'3 a.b.c' 0  #15
916	check 'IFS=". ";set -- a b c;set -- ${xXx:-"$*"};echo $# ${xXx:-$*}' \
917								'1 a b c' 0  #16
918	check 'IFS=". ";set -- a "b c";set -- ${xXx:-"$*"};echo $# ${xXx:-$*}' \
919								'1 a b c' 0  #17
920
921	check 'IFS="";set -- a b c;echo $# ${xXx:-"$*"}'	'3 abc'   0  #18
922	check 'IFS="";set -- a "b c";echo $# ${xXx:-"$*"}'	'2 ab c'  0  #19
923	check 'IFS="";set -- a "b.c";echo $# ${xXx:-"$*"}'	'2 ab.c'  0  #20
924	check 'IFS="";set -- a b c;set -- ${xXx:-"$*"};echo $# ${xXx:-"$*"}' \
925								'1 abc'   0  #21
926	check 'IFS="";set -- a "b c";set -- ${xXx:-"$*"};echo $# ${xXx:-"$*"}' \
927								'1 ab c'  0  #22
928	check 'IFS="";set -- a b c;set -- ${xXx:-$*};echo $# ${xXx:-"$*"}' \
929								'3 abc'   0  #23
930	check 'IFS="";set -- a "b c";set -- ${xXx:-$*};echo $# ${xXx:-"$*"}' \
931								'2 ab c'  0  #24
932	check 'IFS="";set -- a b c;set -- ${xXx:-"$*"};echo $# ${xXx:-$*}' \
933								'1 abc'   0  #25
934	check 'IFS="";set -- a "b c";set -- ${xXx:-"$*"};echo $# ${xXx:-$*}' \
935								'1 ab c'  0  #26
936
937	results	  # FIXED: 'PR bin/52090 - 2 of 26 subtests expected to fail'
938}
939
940atf_init_test_cases() {
941	# Listed here in the order ATF runs them, not the order from above
942
943	atf_add_test_case arithmetic
944	atf_add_test_case dollar_at
945	atf_add_test_case dollar_at_with_text
946	atf_add_test_case dollar_hash
947	atf_add_test_case dollar_star
948	atf_add_test_case dollar_star_in_quoted_word
949	atf_add_test_case dollar_star_in_word
950	atf_add_test_case dollar_star_in_word_empty_ifs
951	atf_add_test_case dollar_star_with_empty_ifs
952	atf_add_test_case iteration_on_null_parameter
953	atf_add_test_case iteration_on_quoted_null_parameter
954	atf_add_test_case iteration_on_null_or_null_parameter
955	atf_add_test_case iteration_on_null_or_missing_parameter
956	atf_add_test_case shell_params
957	atf_add_test_case strip
958	atf_add_test_case wrap_strip
959	atf_add_test_case var_with_embedded_cmdsub
960	atf_add_test_case varpattern_backslashes
961}
962