diff options
author | Denys Vlasenko | 2010-05-21 17:54:46 +0200 |
---|---|---|
committer | Denys Vlasenko | 2010-05-21 17:54:46 +0200 |
commit | 3f78cec34745069cf0a92a16dfccff66d98ef5ba (patch) | |
tree | 1b2b8cd18d3ecfa92b9ae6b5fde3e66366da0cf7 /shell/hush_test/hush-vars | |
parent | 349ef96bb5eae3c487884dd0e88c84a6ba0a1efa (diff) | |
download | busybox-3f78cec34745069cf0a92a16dfccff66d98ef5ba.zip busybox-3f78cec34745069cf0a92a16dfccff66d98ef5ba.tar.gz |
hush: handle expansions in ${var?expanded_word} constructs
function old new delta
expand_vars_to_list 2209 2229 +20
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush_test/hush-vars')
-rw-r--r-- | shell/hush_test/hush-vars/param_expand_indicate_error.right | 15 | ||||
-rwxr-xr-x | shell/hush_test/hush-vars/param_expand_indicate_error.tests | 20 |
2 files changed, 35 insertions, 0 deletions
diff --git a/shell/hush_test/hush-vars/param_expand_indicate_error.right b/shell/hush_test/hush-vars/param_expand_indicate_error.right index 590bb20..06fcc51 100644 --- a/shell/hush_test/hush-vars/param_expand_indicate_error.right +++ b/shell/hush_test/hush-vars/param_expand_indicate_error.right @@ -1,26 +1,41 @@ hush: syntax error: unterminated ${name} 0 0 +==== _ hush: 1: parameter null or not set hush: 1: parameter null or not set hush: 1: message1 hush: 1: message1 +hush: 1: unset! +hush: 1: null or unset! +==== _aaaa _aaaa _aaaa _aaaa _aaaa +_aaaa +_aaaa +==== _ hush: f: parameter null or not set hush: f: parameter null or not set hush: f: message3 hush: f: message3 +hush: f: unset! +hush: f: null or unset! +==== _ _ hush: f: parameter null or not set _ hush: f: message4 +_ +hush: f: null or unset! +==== +_fff +_fff _fff _fff _fff diff --git a/shell/hush_test/hush-vars/param_expand_indicate_error.tests b/shell/hush_test/hush-vars/param_expand_indicate_error.tests index bccba3e..be14b1e 100755 --- a/shell/hush_test/hush-vars/param_expand_indicate_error.tests +++ b/shell/hush_test/hush-vars/param_expand_indicate_error.tests @@ -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}' |