-
-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove redundant fields from CallNode and BinaryNode
- Loading branch information
Showing
9 changed files
with
214 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package checker_test | ||
|
||
import ( | ||
"reflect" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/expr-lang/expr/checker" | ||
"github.com/expr-lang/expr/test/mock" | ||
) | ||
|
||
func TestTypedFuncIndex(t *testing.T) { | ||
fn := func([]any, string) string { | ||
return "foo" | ||
} | ||
index, ok := checker.TypedFuncIndex(reflect.TypeOf(fn), false) | ||
require.True(t, ok) | ||
require.Equal(t, 22, index) | ||
} | ||
|
||
func TestTypedFuncIndex_excludes_named_functions(t *testing.T) { | ||
var fn mock.MyFunc | ||
|
||
_, ok := checker.TypedFuncIndex(reflect.TypeOf(fn), false) | ||
require.False(t, ok) | ||
} |
Oops, something went wrong.