Browse code

Add more test-cases for positional parameters

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2018/05/26 00:45:25
Showing 1 changed files
... ...
@@ -18,7 +18,6 @@ A|'hello\there'            |     hello\there
18 18
 A|'hello\\there'           |     hello\\there
19 19
 A|"''"                     |     ''
20 20
 A|$.                       |     $.
21
-A|$1                       |
22 21
 A|he$1x                    |     hex
23 22
 A|he$.x                    |     he$.x
24 23
 # Next one is different on Windows as $pwd==$PWD
... ...
@@ -137,3 +136,41 @@ A|${:}                      |     error
137 137
 A|${:-bbb}                  |     error
138 138
 A|${:+bbb}                  |     error
139 139
 
140
+# Positional parameters won't be set:
141
+# http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_05_01
142
+A|$1                        |
143
+A|${1}                      |
144
+A|${1:+bbb}                 |
145
+A|${1:-bbb}                 |     bbb
146
+A|$2                        |
147
+A|${2}                      |
148
+A|${2:+bbb}                 |
149
+A|${2:-bbb}                 |     bbb
150
+A|$3                        |
151
+A|${3}                      |
152
+A|${3:+bbb}                 |
153
+A|${3:-bbb}                 |     bbb
154
+A|$4                        |
155
+A|${4}                      |
156
+A|${4:+bbb}                 |
157
+A|${4:-bbb}                 |     bbb
158
+A|$5                        |
159
+A|${5}                      |
160
+A|${5:+bbb}                 |
161
+A|${5:-bbb}                 |     bbb
162
+A|$6                        |
163
+A|${6}                      |
164
+A|${6:+bbb}                 |
165
+A|${6:-bbb}                 |     bbb
166
+A|$7                        |
167
+A|${7}                      |
168
+A|${7:+bbb}                 |
169
+A|${7:-bbb}                 |     bbb
170
+A|$8                        |
171
+A|${8}                      |
172
+A|${8:+bbb}                 |
173
+A|${8:-bbb}                 |     bbb
174
+A|$9                        |
175
+A|${9}                      |
176
+A|${9:+bbb}                 |
177
+A|${9:-bbb}                 |     bbb