Changed some function names and param types

This commit is contained in:
2024-07-31 09:11:57 +02:00
parent a46753f453
commit 3c51b8d2ee
17 changed files with 52 additions and 49 deletions
+4 -5
View File
@@ -35,8 +35,8 @@ func TestFuncs(t *testing.T) {
/* 22 */ {`f=func(a,b){a*2+b}; f(b=2,a=1)`, int64(4), nil},
/* 23 */ {`f=func(a=10,b=10){a*2+b}; f(b=1)`, int64(21), nil},
/* 24 */ {`f=func(a,b){a*2+b}; f(a=1,2)`, nil, `f(): positional param nr 2 not allowed after named params`},
// /* 20 */ {`a=[func(){3}]; a[0]()`, int64(3), nil},
// /* 20 */ {`m={}; m["f"]=func(){3}; m["f"]()`, int64(3), nil},
// /* 20 */ {`a=[func(){3}]; a[0]()`, int64(3), nil},
// /* 20 */ {`m={}; m["f"]=func(){3}; m["f"]()`, int64(3), nil},
// /* 18 */ {`f=func(a){a*2}`, nil, errors.New(`[1:24] expected "function-param-value", got ")"`)},
}
@@ -51,7 +51,7 @@ func dummy(ctx ExprContext, name string, args map[string]any) (result any, err e
}
func TestFunctionToStringSimple(t *testing.T) {
source := NewGolangFunctor2(dummy)
source := NewGolangFunctor(dummy)
want := "func(){}"
got := source.ToString(0)
if got != want {
@@ -59,9 +59,8 @@ func TestFunctionToStringSimple(t *testing.T) {
}
}
func TestFunctionGetFunc(t *testing.T) {
source := NewGolangFunctor2(dummy)
source := NewGolangFunctor(dummy)
want := ExprFunc(nil)
got := source.GetFunc()
if got != want {