@@ -301,44 +301,44 @@ func TestChecker_Check(t *testing.T) {
301301 "variadic options with bad type" ,
302302 `
303303 fs default() {
304- myfunc option::run {} option::copy {}
304+ myfunc "string"
305305 }
306306 fs myfunc(variadic option::run opts) {
307307 image "busybox"
308308 run "echo hi" with opts
309309 }
310310 ` ,
311311 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+ }
318319 }
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+ `
330330 fs default() {
331- myfunc option::run {} option::copy {}
331+ myfunc option::run {} "string"
332332 }
333333 fs myfunc(variadic option::run opts) {
334334 image "busybox"
335335 run "echo hi" with opts
336336 }
337337 ` ,
338- ErrWrongArgType {},
339- }, {
340- "func call with bad arg count" ,
341- `
338+ ErrWrongArgType {},
339+ }, {
340+ "func call with bad arg count" ,
341+ `
342342 fs default() {
343343 myfunc "a" "b"
344344 }
@@ -347,10 +347,10 @@ func TestChecker_Check(t *testing.T) {
347347 run cmd
348348 }
349349 ` ,
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+ `
354354 fs default() {
355355 myfunc 1
356356 }
@@ -359,8 +359,8 @@ func TestChecker_Check(t *testing.T) {
359359 run cmd
360360 }
361361 ` ,
362- ErrWrongArgType {},
363- }, /*{
362+ ErrWrongArgType {},
363+ }, /*{
364364 "func call with bad arg type: basic ident",
365365 `
366366 fs default() {
@@ -419,6 +419,63 @@ func TestChecker_Check(t *testing.T) {
419419 image "busybox"
420420 run cmd
421421 }
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() {}
422479 `,
423480 ErrWrongArgType{},
424481 }*/ } {
0 commit comments