Skip to content

Commit

Permalink
add a few more cases for call variants
Browse files Browse the repository at this point in the history
  • Loading branch information
slushie committed Apr 21, 2020
1 parent cbc87e2 commit 0b05571
Showing 1 changed file with 86 additions and 29 deletions.
115 changes: 86 additions & 29 deletions checker/checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,44 +301,44 @@ func TestChecker_Check(t *testing.T) {
"variadic options with bad type",
`
fs default() {
myfunc option::run {} option::copy {}
myfunc "string"
}
fs myfunc(variadic option::run opts) {
image "busybox"
run "echo hi" with opts
}
`,
ErrWrongArgType{},
}, {
"variadic options with bad method type",
`
fs default() {
myfunc option::run {
copyOpt
}, /*{
"variadic options with bad method type",
`
fs default() {
myfunc option::run {
copyOpt
}
}
}
fs myfunc(variadic option::run opts) {
image "busybox"
run "echo hi" with opts
}
option::copy copyOpt() {}
`,
ErrWrongArgType{},
}, {
"variadic options with mixed types",
`
fs myfunc(variadic option::run opts) {
image "busybox"
run "echo hi" with opts
}
option::copy copyOpt() {}
`,
ErrWrongArgType{},
},*/{
"variadic options with mixed types",
`
fs default() {
myfunc option::run {} option::copy {}
myfunc option::run {} "string"
}
fs myfunc(variadic option::run opts) {
image "busybox"
run "echo hi" with opts
}
`,
ErrWrongArgType{},
}, {
"func call with bad arg count",
`
ErrWrongArgType{},
}, {
"func call with bad arg count",
`
fs default() {
myfunc "a" "b"
}
Expand All @@ -347,10 +347,10 @@ func TestChecker_Check(t *testing.T) {
run cmd
}
`,
ErrNumArgs{},
}, {
"func call with bad arg type: basic literal",
`
ErrNumArgs{},
}, {
"func call with bad arg type: basic literal",
`
fs default() {
myfunc 1
}
Expand All @@ -359,8 +359,8 @@ func TestChecker_Check(t *testing.T) {
run cmd
}
`,
ErrWrongArgType{},
}, /*{
ErrWrongArgType{},
}, /*{
"func call with bad arg type: basic ident",
`
fs default() {
Expand Down Expand Up @@ -419,6 +419,63 @@ func TestChecker_Check(t *testing.T) {
image "busybox"
run cmd
}
`,
ErrWrongArgType{},
},*/{
"func call with option",
`
fs default() {
scratch
run "foo" with option {
mount fs { scratch; } "/"
}
}
`,
nil,
}, {
"func call with user-defined option",
`
fs default() {
scratch
run "foo" with option {
fooOpt
}
}
option::run fooOpt() {}
`,
nil,
}, {
"func call with hoisted option",
`
fs default() {
scratch
run "foo" with fooOpt
}
option::run fooOpt() {}
`,
nil,
}, /*{
"func call with bad option type",
`
fs default() {
scratch
run "foo" with option {
fooOpt
}
}
option::copy fooOpt() {}
`,
ErrWrongArgType{},
},*/ /*{
"func call with bad hoisted option type",
`
fs default() {
scratch
run "foo" with option {
fooOpt
}
}
option::copy fooOpt() {}
`,
ErrWrongArgType{},
}*/} {
Expand Down

0 comments on commit 0b05571

Please sign in to comment.