diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-21 17:54:46 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-21 17:54:46 +0200 |
commit | 3f78cec34745069cf0a92a16dfccff66d98ef5ba (patch) | |
tree | 1b2b8cd18d3ecfa92b9ae6b5fde3e66366da0cf7 /shell/hush_test | |
parent | 349ef96bb5eae3c487884dd0e88c84a6ba0a1efa (diff) | |
download | busybox-w32-3f78cec34745069cf0a92a16dfccff66d98ef5ba.tar.gz busybox-w32-3f78cec34745069cf0a92a16dfccff66d98ef5ba.tar.bz2 busybox-w32-3f78cec34745069cf0a92a16dfccff66d98ef5ba.zip |
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')
-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 590bb2001..06fcc5104 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 @@ | |||
1 | hush: syntax error: unterminated ${name} | 1 | hush: syntax error: unterminated ${name} |
2 | 0 | 2 | 0 |
3 | 0 | 3 | 0 |
4 | ==== | ||
4 | _ | 5 | _ |
5 | hush: 1: parameter null or not set | 6 | hush: 1: parameter null or not set |
6 | hush: 1: parameter null or not set | 7 | hush: 1: parameter null or not set |
7 | hush: 1: message1 | 8 | hush: 1: message1 |
8 | hush: 1: message1 | 9 | hush: 1: message1 |
10 | hush: 1: unset! | ||
11 | hush: 1: null or unset! | ||
12 | ==== | ||
9 | _aaaa | 13 | _aaaa |
10 | _aaaa | 14 | _aaaa |
11 | _aaaa | 15 | _aaaa |
12 | _aaaa | 16 | _aaaa |
13 | _aaaa | 17 | _aaaa |
18 | _aaaa | ||
19 | _aaaa | ||
20 | ==== | ||
14 | _ | 21 | _ |
15 | hush: f: parameter null or not set | 22 | hush: f: parameter null or not set |
16 | hush: f: parameter null or not set | 23 | hush: f: parameter null or not set |
17 | hush: f: message3 | 24 | hush: f: message3 |
18 | hush: f: message3 | 25 | hush: f: message3 |
26 | hush: f: unset! | ||
27 | hush: f: null or unset! | ||
28 | ==== | ||
19 | _ | 29 | _ |
20 | _ | 30 | _ |
21 | hush: f: parameter null or not set | 31 | hush: f: parameter null or not set |
22 | _ | 32 | _ |
23 | hush: f: message4 | 33 | hush: f: message4 |
34 | _ | ||
35 | hush: f: null or unset! | ||
36 | ==== | ||
37 | _fff | ||
38 | _fff | ||
24 | _fff | 39 | _fff |
25 | _fff | 40 | _fff |
26 | _fff | 41 | _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 bccba3e1b..be14b1e37 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 @@ | |||
5 | "$THIS_SH" -c 'echo ${:?}' | 5 | "$THIS_SH" -c 'echo ${:?}' |
6 | 6 | ||
7 | # then some funky ones | 7 | # then some funky ones |
8 | # note: bash prints 1 - treats it as "length of $#"? We print 0 | ||
8 | "$THIS_SH" -c 'echo ${#?}' | 9 | "$THIS_SH" -c 'echo ${#?}' |
10 | # bash prints 0 | ||
9 | "$THIS_SH" -c 'echo ${#:?}' | 11 | "$THIS_SH" -c 'echo ${#:?}' |
10 | 12 | ||
11 | # now some valid ones | 13 | # now some valid ones |
14 | export msg_unset="unset!" | ||
15 | export msg_null_or_unset="null or unset!" | ||
16 | |||
17 | echo ==== | ||
12 | "$THIS_SH" -c 'set --; echo _$1' | 18 | "$THIS_SH" -c 'set --; echo _$1' |
13 | "$THIS_SH" -c 'set --; echo _${1?}' | 19 | "$THIS_SH" -c 'set --; echo _${1?}' |
14 | "$THIS_SH" -c 'set --; echo _${1:?}' | 20 | "$THIS_SH" -c 'set --; echo _${1:?}' |
15 | "$THIS_SH" -c 'set --; echo _${1?message1}' | 21 | "$THIS_SH" -c 'set --; echo _${1?message1}' |
16 | "$THIS_SH" -c 'set --; echo _${1:?message1}' | 22 | "$THIS_SH" -c 'set --; echo _${1:?message1}' |
23 | "$THIS_SH" -c 'set --; echo _${1?$msg_unset}' | ||
24 | "$THIS_SH" -c 'set --; echo _${1:?$msg_null_or_unset}' | ||
17 | 25 | ||
26 | echo ==== | ||
18 | "$THIS_SH" -c 'set -- aaaa; echo _$1' | 27 | "$THIS_SH" -c 'set -- aaaa; echo _$1' |
19 | "$THIS_SH" -c 'set -- aaaa; echo _${1?}' | 28 | "$THIS_SH" -c 'set -- aaaa; echo _${1?}' |
20 | "$THIS_SH" -c 'set -- aaaa; echo _${1:?}' | 29 | "$THIS_SH" -c 'set -- aaaa; echo _${1:?}' |
21 | "$THIS_SH" -c 'set -- aaaa; echo _${1?word}' | 30 | "$THIS_SH" -c 'set -- aaaa; echo _${1?word}' |
22 | "$THIS_SH" -c 'set -- aaaa; echo _${1:?word}' | 31 | "$THIS_SH" -c 'set -- aaaa; echo _${1:?word}' |
32 | "$THIS_SH" -c 'set -- aaaa; echo _${1?$msg_unset}' | ||
33 | "$THIS_SH" -c 'set -- aaaa; echo _${1:?$msg_null_or_unset}' | ||
23 | 34 | ||
35 | echo ==== | ||
24 | "$THIS_SH" -c 'unset f; echo _$f' | 36 | "$THIS_SH" -c 'unset f; echo _$f' |
25 | "$THIS_SH" -c 'unset f; echo _${f?}' | 37 | "$THIS_SH" -c 'unset f; echo _${f?}' |
26 | "$THIS_SH" -c 'unset f; echo _${f:?}' | 38 | "$THIS_SH" -c 'unset f; echo _${f:?}' |
27 | "$THIS_SH" -c 'unset f; echo _${f?message3}' | 39 | "$THIS_SH" -c 'unset f; echo _${f?message3}' |
28 | "$THIS_SH" -c 'unset f; echo _${f:?message3}' | 40 | "$THIS_SH" -c 'unset f; echo _${f:?message3}' |
41 | "$THIS_SH" -c 'unset f; echo _${f?$msg_unset}' | ||
42 | "$THIS_SH" -c 'unset f; echo _${f:?$msg_null_or_unset}' | ||
29 | 43 | ||
44 | echo ==== | ||
30 | "$THIS_SH" -c 'f=; echo _$f' | 45 | "$THIS_SH" -c 'f=; echo _$f' |
31 | "$THIS_SH" -c 'f=; echo _${f?}' | 46 | "$THIS_SH" -c 'f=; echo _${f?}' |
32 | "$THIS_SH" -c 'f=; echo _${f:?}' | 47 | "$THIS_SH" -c 'f=; echo _${f:?}' |
33 | "$THIS_SH" -c 'f=; echo _${f?word}' | 48 | "$THIS_SH" -c 'f=; echo _${f?word}' |
34 | "$THIS_SH" -c 'f=; echo _${f:?message4}' | 49 | "$THIS_SH" -c 'f=; echo _${f:?message4}' |
50 | "$THIS_SH" -c 'f=; echo _${f?$msg_unset}' | ||
51 | "$THIS_SH" -c 'f=; echo _${f:?$msg_null_or_unset}' | ||
35 | 52 | ||
53 | echo ==== | ||
36 | "$THIS_SH" -c 'f=fff; echo _$f' | 54 | "$THIS_SH" -c 'f=fff; echo _$f' |
37 | "$THIS_SH" -c 'f=fff; echo _${f?}' | 55 | "$THIS_SH" -c 'f=fff; echo _${f?}' |
38 | "$THIS_SH" -c 'f=fff; echo _${f:?}' | 56 | "$THIS_SH" -c 'f=fff; echo _${f:?}' |
39 | "$THIS_SH" -c 'f=fff; echo _${f?word}' | 57 | "$THIS_SH" -c 'f=fff; echo _${f?word}' |
40 | "$THIS_SH" -c 'f=fff; echo _${f:?word}' | 58 | "$THIS_SH" -c 'f=fff; echo _${f:?word}' |
59 | "$THIS_SH" -c 'f=fff; echo _${f?$msg_unset}' | ||
60 | "$THIS_SH" -c 'f=fff; echo _${f:?$msg_null_or_unset}' | ||