@@ -267,6 +267,86 @@ func TestConfigSSH_FileWriteAndOptionsFlow(t *testing.T) {
267
267
{match : "Continue?" , write : "yes" },
268
268
},
269
269
},
270
+ {
271
+ name : "Included file must be named exactly coder, otherwise leave as-is" ,
272
+ writeConfig : writeConfig {
273
+ ssh : strings .Join ([]string {
274
+ "Host test" ,
275
+ " HostName test" ,
276
+ "" ,
277
+ "Include coders" ,
278
+ "" ,
279
+ }, "\n " ),
280
+ },
281
+ wantConfig : wantConfig {
282
+ ssh : strings .Join ([]string {
283
+ "Include coder" ,
284
+ "" ,
285
+ "Host test" ,
286
+ " HostName test" ,
287
+ "" ,
288
+ "Include coders" ,
289
+ "" ,
290
+ }, "\n " ),
291
+ },
292
+ matches : []match {
293
+ {match : "Continue?" , write : "yes" },
294
+ },
295
+ },
296
+ {
297
+ name : "Second file added, Include(s) left as-is, new one on top" ,
298
+ writeConfig : writeConfig {
299
+ ssh : strings .Join ([]string {
300
+ "Host test" ,
301
+ " HostName test" ,
302
+ "" ,
303
+ "Include coder other" ,
304
+ "Include other coder" ,
305
+ "" ,
306
+ }, "\n " ),
307
+ },
308
+ wantConfig : wantConfig {
309
+ ssh : strings .Join ([]string {
310
+ "Include coder" ,
311
+ "" ,
312
+ "Host test" ,
313
+ " HostName test" ,
314
+ "" ,
315
+ "Include coder other" ,
316
+ "Include other coder" ,
317
+ "" ,
318
+ }, "\n " ),
319
+ },
320
+ matches : []match {
321
+ {match : "Continue?" , write : "yes" },
322
+ },
323
+ },
324
+ {
325
+ name : "Comment added, Include left as-is, new one on top" ,
326
+ writeConfig : writeConfig {
327
+ ssh : strings .Join ([]string {
328
+ "Host test" ,
329
+ " HostName test" ,
330
+ "" ,
331
+ "Include coder # comment" ,
332
+ "" ,
333
+ }, "\n " ),
334
+ },
335
+ wantConfig : wantConfig {
336
+ ssh : strings .Join ([]string {
337
+ "Include coder" ,
338
+ "" ,
339
+ "Host test" ,
340
+ " HostName test" ,
341
+ "" ,
342
+ "Include coder # comment" ,
343
+ "" ,
344
+ }, "\n " ),
345
+ },
346
+ matches : []match {
347
+ {match : "Continue?" , write : "yes" },
348
+ },
349
+ },
270
350
{
271
351
name : "SSH Config does not need modification" ,
272
352
writeConfig : writeConfig {
0 commit comments