Skip to content

Commit 1719809

Browse files
committed
Fix tests
1 parent ed89647 commit 1719809

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

checker/info_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package checker_test
33
import (
44
"reflect"
55
"testing"
6+
"time"
67

78
"github.com/stretchr/testify/require"
89

@@ -11,12 +12,12 @@ import (
1112
)
1213

1314
func TestTypedFuncIndex(t *testing.T) {
14-
fn := func([]any, string) string {
15-
return "foo"
15+
fn := func() time.Duration {
16+
return 1 * time.Second
1617
}
1718
index, ok := checker.TypedFuncIndex(reflect.TypeOf(fn), false)
1819
require.True(t, ok)
19-
require.Equal(t, 22, index)
20+
require.Equal(t, 1, index)
2021
}
2122

2223
func TestTypedFuncIndex_excludes_named_functions(t *testing.T) {

compiler/compiler_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ func TestCompile(t *testing.T) {
319319
vm.OpMethod,
320320
vm.OpCallTyped,
321321
},
322-
Arguments: []int{0, 0, 1, 10},
322+
Arguments: []int{0, 0, 1, 12},
323323
},
324324
},
325325
}
@@ -358,15 +358,15 @@ func TestCompile_FuncTypes(t *testing.T) {
358358
program, err := expr.Compile("fn([1, 2], 'bar')", expr.Env(env))
359359
require.NoError(t, err)
360360
require.Equal(t, vm.OpCallTyped, program.Bytecode[3])
361-
require.Equal(t, 22, program.Arguments[3])
361+
require.Equal(t, 32, program.Arguments[3])
362362
}
363363

364364
func TestCompile_FuncTypes_with_Method(t *testing.T) {
365365
env := mock.Env{}
366366
program, err := expr.Compile("FuncTyped('bar')", expr.Env(env))
367367
require.NoError(t, err)
368368
require.Equal(t, vm.OpCallTyped, program.Bytecode[2])
369-
require.Equal(t, 42, program.Arguments[2])
369+
require.Equal(t, 76, program.Arguments[2])
370370
}
371371

372372
func TestCompile_FuncTypes_excludes_named_functions(t *testing.T) {

0 commit comments

Comments
 (0)