@@ -113,6 +113,11 @@ test('$ allows array interpolation', async t => {
113
113
t . is ( stdout , 'foo\nbar' ) ;
114
114
} ) ;
115
115
116
+ test ( '$ allows empty array interpolation' , async t => {
117
+ const { stdout} = await $ `echo.js foo ${ [ ] } bar` ;
118
+ t . is ( stdout , 'foo\nbar' ) ;
119
+ } ) ;
120
+
116
121
test ( '$ allows execa return value interpolation' , async t => {
117
122
const foo = await $ `echo.js foo` ;
118
123
const { stdout} = await $ `echo.js ${ foo } bar` ;
@@ -172,6 +177,46 @@ test('$ handles invalid escape sequence', async t => {
172
177
t . is ( stdout , '\\u' ) ;
173
178
} ) ;
174
179
180
+ test ( '$ can concatenate at the end of tokens' , async t => {
181
+ const { stdout} = await $ `echo.js foo${ 'bar' } ` ;
182
+ t . is ( stdout , 'foobar' ) ;
183
+ } ) ;
184
+
185
+ test ( '$ does not concatenate at the end of tokens with a space' , async t => {
186
+ const { stdout} = await $ `echo.js foo ${ 'bar' } ` ;
187
+ t . is ( stdout , 'foo\nbar' ) ;
188
+ } ) ;
189
+
190
+ test ( '$ can concatenate at the end of tokens followed by an array' , async t => {
191
+ const { stdout} = await $ `echo.js foo${ [ 'bar' , 'foo' ] } ` ;
192
+ t . is ( stdout , 'foobar\nfoo' ) ;
193
+ } ) ;
194
+
195
+ test ( '$ can concatenate at the start of tokens' , async t => {
196
+ const { stdout} = await $ `echo.js ${ 'foo' } bar` ;
197
+ t . is ( stdout , 'foobar' ) ;
198
+ } ) ;
199
+
200
+ test ( '$ does not concatenate at the start of tokens with a space' , async t => {
201
+ const { stdout} = await $ `echo.js ${ 'foo' } bar` ;
202
+ t . is ( stdout , 'foo\nbar' ) ;
203
+ } ) ;
204
+
205
+ test ( '$ can concatenate at the start of tokens followed by an array' , async t => {
206
+ const { stdout} = await $ `echo.js ${ [ 'foo' , 'bar' ] } foo` ;
207
+ t . is ( stdout , 'foo\nbarfoo' ) ;
208
+ } ) ;
209
+
210
+ test ( '$ can concatenate at the start and end of tokens followed by an array' , async t => {
211
+ const { stdout} = await $ `echo.js foo${ [ 'bar' , 'foo' ] } bar` ;
212
+ t . is ( stdout , 'foobar\nfoobar' ) ;
213
+ } ) ;
214
+
215
+ test ( '$ can concatenate multiple tokens' , async t => {
216
+ const { stdout} = await $ `echo.js ${ 'foo' } bar${ 'foo' } ` ;
217
+ t . is ( stdout , 'foobarfoo' ) ;
218
+ } ) ;
219
+
175
220
test ( '$ allows escaping spaces in commands with interpolation' , async t => {
176
221
const { stdout} = await $ `${ 'command with space.js' } foo bar` ;
177
222
t . is ( stdout , 'foo\nbar' ) ;
0 commit comments