aboutsummaryrefslogtreecommitdiff
path: root/shell/ash_test
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2018-07-20 17:36:06 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2018-07-20 17:36:06 +0200
commit83e434d5b56baccf617ebcc8a752959f7c4aacfc (patch)
tree46a311ce40ba3f2e444d6cbf0c306351393498bf /shell/ash_test
parent294eb4612cd668521faa48711297196f00af61d9 (diff)
downloadbusybox-w32-83e434d5b56baccf617ebcc8a752959f7c4aacfc.tar.gz
busybox-w32-83e434d5b56baccf617ebcc8a752959f7c4aacfc.tar.bz2
busybox-w32-83e434d5b56baccf617ebcc8a752959f7c4aacfc.zip
hush: fix handling of '' in ${var:+ARG}
This wasn't an ash bug in dollar_altvalue9, it was hush bug (and bash!) function old new delta expand_one_var 2236 2254 +18 expand_vars_to_list 1097 1103 +6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 24/0) Total: 24 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash_test')
-rw-r--r--shell/ash_test/ash-quoting/dollar_altvalue2.right69
-rwxr-xr-xshell/ash_test/ash-quoting/dollar_altvalue2.tests33
-rw-r--r--shell/ash_test/ash-quoting/dollar_altvalue9.right2
3 files changed, 104 insertions, 0 deletions
diff --git a/shell/ash_test/ash-quoting/dollar_altvalue2.right b/shell/ash_test/ash-quoting/dollar_altvalue2.right
new file mode 100644
index 000000000..7cf37e379
--- /dev/null
+++ b/shell/ash_test/ash-quoting/dollar_altvalue2.right
@@ -0,0 +1,69 @@
1Unquoted '':
2start:
3||
4end
5start:
6||
7end
8start:
9||
10end
11start:
12||
13end
14start:
15||
16||
17end
18
19Unquoted "":
20start:
21||
22end
23start:
24||
25end
26start:
27||
28end
29start:
30||
31end
32start:
33||
34||
35end
36
37Quoted '':
38start:
39|''|
40end
41start:
42|'' |
43end
44start:
45| ''|
46end
47start:
48| '' |
49end
50start:
51|'' ''|
52end
53
54Quoted "":
55start:
56||
57end
58start:
59| |
60end
61start:
62| |
63end
64start:
65| |
66end
67start:
68| |
69end
diff --git a/shell/ash_test/ash-quoting/dollar_altvalue2.tests b/shell/ash_test/ash-quoting/dollar_altvalue2.tests
new file mode 100755
index 000000000..3377eb27f
--- /dev/null
+++ b/shell/ash_test/ash-quoting/dollar_altvalue2.tests
@@ -0,0 +1,33 @@
1f() { echo start:; for i; do echo "|$i|"; done; echo end; }
2x=a
3
4echo "Unquoted '':"
5f ${x:+''}
6f ${x:+'' }
7f ${x:+ ''}
8f ${x:+ '' }
9f ${x:+'' ''}
10
11echo
12echo 'Unquoted "":'
13f ${x:+""}
14f ${x:+"" }
15f ${x:+ ""}
16f ${x:+ "" }
17f ${x:+"" ""}
18
19echo
20echo "Quoted '':"
21f "${x:+''}"
22f "${x:+'' }"
23f "${x:+ ''}"
24f "${x:+ '' }"
25f "${x:+'' ''}"
26
27echo
28echo 'Quoted "":'
29f "${x:+""}"
30f "${x:+"" }"
31f "${x:+ ""}"
32f "${x:+ "" }"
33f "${x:+"" ""}"
diff --git a/shell/ash_test/ash-quoting/dollar_altvalue9.right b/shell/ash_test/ash-quoting/dollar_altvalue9.right
index fc6c2697c..39342fe7c 100644
--- a/shell/ash_test/ash-quoting/dollar_altvalue9.right
+++ b/shell/ash_test/ash-quoting/dollar_altvalue9.right
@@ -3,6 +3,7 @@ Unquoted 1:
3|x y| 3|x y|
4|1| 4|1|
5|2| 5|2|
6||
6|1 2| 7|1 2|
7|A| 8|A|
8|B| 9|B|
@@ -14,6 +15,7 @@ Unquoted 2:
14|ax y| 15|ax y|
15|1| 16|1|
16|2| 17|2|
18||
17|1 2| 19|1 2|
18|A| 20|A|
19|B| 21|B|