hush: make getch/peek functions directly called
[oweals/busybox.git] / shell / hush_test / hush-vars / param_expand_indicate_error.tests
index bccba3e1b6bac956121feec4b45ea9304efe4159..be14b1e372b587978d7dddc76fc24e4bfe0e2cea 100755 (executable)
@@ -5,36 +5,56 @@
 "$THIS_SH" -c 'echo ${:?}'
 
 # then some funky ones
+# note: bash prints 1 - treats it as "length of $#"? We print 0
 "$THIS_SH" -c 'echo ${#?}'
+# bash prints 0
 "$THIS_SH" -c 'echo ${#:?}'
 
 # now some valid ones
+export msg_unset="unset!"
+export msg_null_or_unset="null or unset!"
+
+echo ====
 "$THIS_SH" -c 'set --; echo _$1'
 "$THIS_SH" -c 'set --; echo _${1?}'
 "$THIS_SH" -c 'set --; echo _${1:?}'
 "$THIS_SH" -c 'set --; echo _${1?message1}'
 "$THIS_SH" -c 'set --; echo _${1:?message1}'
+"$THIS_SH" -c 'set --; echo _${1?$msg_unset}'
+"$THIS_SH" -c 'set --; echo _${1:?$msg_null_or_unset}'
 
+echo ====
 "$THIS_SH" -c 'set -- aaaa; echo _$1'
 "$THIS_SH" -c 'set -- aaaa; echo _${1?}'
 "$THIS_SH" -c 'set -- aaaa; echo _${1:?}'
 "$THIS_SH" -c 'set -- aaaa; echo _${1?word}'
 "$THIS_SH" -c 'set -- aaaa; echo _${1:?word}'
+"$THIS_SH" -c 'set -- aaaa; echo _${1?$msg_unset}'
+"$THIS_SH" -c 'set -- aaaa; echo _${1:?$msg_null_or_unset}'
 
+echo ====
 "$THIS_SH" -c 'unset f; echo _$f'
 "$THIS_SH" -c 'unset f; echo _${f?}'
 "$THIS_SH" -c 'unset f; echo _${f:?}'
 "$THIS_SH" -c 'unset f; echo _${f?message3}'
 "$THIS_SH" -c 'unset f; echo _${f:?message3}'
+"$THIS_SH" -c 'unset f; echo _${f?$msg_unset}'
+"$THIS_SH" -c 'unset f; echo _${f:?$msg_null_or_unset}'
 
+echo ====
 "$THIS_SH" -c 'f=; echo _$f'
 "$THIS_SH" -c 'f=; echo _${f?}'
 "$THIS_SH" -c 'f=; echo _${f:?}'
 "$THIS_SH" -c 'f=; echo _${f?word}'
 "$THIS_SH" -c 'f=; echo _${f:?message4}'
+"$THIS_SH" -c 'f=; echo _${f?$msg_unset}'
+"$THIS_SH" -c 'f=; echo _${f:?$msg_null_or_unset}'
 
+echo ====
 "$THIS_SH" -c 'f=fff; echo _$f'
 "$THIS_SH" -c 'f=fff; echo _${f?}'
 "$THIS_SH" -c 'f=fff; echo _${f:?}'
 "$THIS_SH" -c 'f=fff; echo _${f?word}'
 "$THIS_SH" -c 'f=fff; echo _${f:?word}'
+"$THIS_SH" -c 'f=fff; echo _${f?$msg_unset}'
+"$THIS_SH" -c 'f=fff; echo _${f:?$msg_null_or_unset}'