@@ -301,44 +301,44 @@ func TestChecker_Check(t *testing.T) {
301
301
"variadic options with bad type" ,
302
302
`
303
303
fs default() {
304
- myfunc option::run {} option::copy {}
304
+ myfunc "string"
305
305
}
306
306
fs myfunc(variadic option::run opts) {
307
307
image "busybox"
308
308
run "echo hi" with opts
309
309
}
310
310
` ,
311
311
ErrWrongArgType {},
312
- }, {
313
- "variadic options with bad method type" ,
314
- `
315
- fs default() {
316
- myfunc option::run {
317
- copyOpt
312
+ }, /*{
313
+ "variadic options with bad method type",
314
+ `
315
+ fs default() {
316
+ myfunc option::run {
317
+ copyOpt
318
+ }
318
319
}
319
- }
320
- fs myfunc(variadic option::run opts) {
321
- image "busybox"
322
- run "echo hi" with opts
323
- }
324
- option::copy copyOpt() {}
325
- ` ,
326
- ErrWrongArgType {},
327
- }, {
328
- "variadic options with mixed types" ,
329
- `
320
+ fs myfunc(variadic option::run opts) {
321
+ image "busybox"
322
+ run "echo hi" with opts
323
+ }
324
+ option::copy copyOpt() {}
325
+ `,
326
+ ErrWrongArgType{},
327
+ },*/ {
328
+ "variadic options with mixed types" ,
329
+ `
330
330
fs default() {
331
- myfunc option::run {} option::copy {}
331
+ myfunc option::run {} "string"
332
332
}
333
333
fs myfunc(variadic option::run opts) {
334
334
image "busybox"
335
335
run "echo hi" with opts
336
336
}
337
337
` ,
338
- ErrWrongArgType {},
339
- }, {
340
- "func call with bad arg count" ,
341
- `
338
+ ErrWrongArgType {},
339
+ }, {
340
+ "func call with bad arg count" ,
341
+ `
342
342
fs default() {
343
343
myfunc "a" "b"
344
344
}
@@ -347,10 +347,10 @@ func TestChecker_Check(t *testing.T) {
347
347
run cmd
348
348
}
349
349
` ,
350
- ErrNumArgs {},
351
- }, {
352
- "func call with bad arg type: basic literal" ,
353
- `
350
+ ErrNumArgs {},
351
+ }, {
352
+ "func call with bad arg type: basic literal" ,
353
+ `
354
354
fs default() {
355
355
myfunc 1
356
356
}
@@ -359,8 +359,8 @@ func TestChecker_Check(t *testing.T) {
359
359
run cmd
360
360
}
361
361
` ,
362
- ErrWrongArgType {},
363
- }, /*{
362
+ ErrWrongArgType {},
363
+ }, /*{
364
364
"func call with bad arg type: basic ident",
365
365
`
366
366
fs default() {
@@ -419,6 +419,63 @@ func TestChecker_Check(t *testing.T) {
419
419
image "busybox"
420
420
run cmd
421
421
}
422
+ `,
423
+ ErrWrongArgType{},
424
+ },*/ {
425
+ "func call with option" ,
426
+ `
427
+ fs default() {
428
+ scratch
429
+ run "foo" with option {
430
+ mount fs { scratch; } "/"
431
+ }
432
+ }
433
+ ` ,
434
+ nil ,
435
+ }, {
436
+ "func call with user-defined option" ,
437
+ `
438
+ fs default() {
439
+ scratch
440
+ run "foo" with option {
441
+ fooOpt
442
+ }
443
+ }
444
+ option::run fooOpt() {}
445
+ ` ,
446
+ nil ,
447
+ }, {
448
+ "func call with hoisted option" ,
449
+ `
450
+ fs default() {
451
+ scratch
452
+ run "foo" with fooOpt
453
+ }
454
+ option::run fooOpt() {}
455
+ ` ,
456
+ nil ,
457
+ }, /*{
458
+ "func call with bad option type",
459
+ `
460
+ fs default() {
461
+ scratch
462
+ run "foo" with option {
463
+ fooOpt
464
+ }
465
+ }
466
+ option::copy fooOpt() {}
467
+ `,
468
+ ErrWrongArgType{},
469
+ },*/ /*{
470
+ "func call with bad hoisted option type",
471
+ `
472
+ fs default() {
473
+ scratch
474
+ run "foo" with option {
475
+ fooOpt
476
+ }
477
+ }
478
+ option::copy fooOpt() {}
422
479
`,
423
480
ErrWrongArgType{},
424
481
}*/ } {
0 commit comments