Skip to content

Commit

Permalink
expr-lang#725: Test to prove bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MEZk committed Nov 7, 2024
1 parent 24a21b2 commit 527303c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,7 @@ func (v *checker) checkFunction(f *builtin.Function, node ast.Node, arguments []
return v.error(node, "no matching overload for %v", f.Name)
}

// TODO:
func (v *checker) checkArguments(
name string,
fn Nature,
Expand Down
1 change: 1 addition & 0 deletions checker/checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func TestCheck(t *testing.T) {
{"Bool ?? Bool"},
{"let foo = 1; foo == 1"},
{"(Embed).EmbedPointerEmbedInt > 0"},
{"Foo.MethodWithSliceArguments([\"a\", \"prefix\"]) == true"},
}

for _, tt := range tests {
Expand Down
9 changes: 9 additions & 0 deletions test/mock/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,15 @@ func (Foo) Method() Bar {
}
}

func (Foo) MethodWithSliceArguments(args []string) bool {
for _, a := range args {
if strings.HasPrefix(a, "prefix") {
return true
}
}
return false
}

func (f Foo) MethodWithArgs(prefix string) string {
return prefix + f.Value
}
Expand Down

0 comments on commit 527303c

Please sign in to comment.