(t *testing.T)
| 964 | } |
| 965 | |
| 966 | func TestFunctionEnableDeclaration(t *testing.T) { |
| 967 | fn, err := NewFunction("in", |
| 968 | DisableDeclaration(false), |
| 969 | Overload("in_list", |
| 970 | []*types.Type{types.NewListType(types.NewTypeParamType("K")), types.NewTypeParamType("K")}, |
| 971 | types.BoolType), |
| 972 | ) |
| 973 | if err != nil { |
| 974 | t.Fatalf("NewFunction() failed: %v", err) |
| 975 | } |
| 976 | if fn.IsDeclarationDisabled() { |
| 977 | t.Error("got declaration disabled, wanted enabled") |
| 978 | } |
| 979 | fn2, err := NewFunction("in", |
| 980 | DisableDeclaration(true), |
| 981 | Overload("in_list", |
| 982 | []*types.Type{types.NewListType(types.NewTypeParamType("K")), types.NewTypeParamType("K")}, |
| 983 | types.BoolType), |
| 984 | ) |
| 985 | if err != nil { |
| 986 | t.Fatalf("NewFunction() failed: %v", err) |
| 987 | } |
| 988 | if !fn2.IsDeclarationDisabled() { |
| 989 | t.Error("got declaration enabled, wanted disabled") |
| 990 | } |
| 991 | |
| 992 | // enabled -> disabled |
| 993 | merged, err := fn.Merge(fn2) |
| 994 | if err != nil { |
| 995 | t.Fatalf("fn.Merge(fn2) failed: %v", err) |
| 996 | } |
| 997 | if !merged.IsDeclarationDisabled() { |
| 998 | t.Error("got declaration enabled, wanted disabled") |
| 999 | } |
| 1000 | // disabled -> enabled |
| 1001 | merged2, err := fn2.Merge(fn) |
| 1002 | if err != nil { |
| 1003 | t.Fatalf("fn.Merge(fn2) failed: %v", err) |
| 1004 | } |
| 1005 | if merged2.IsDeclarationDisabled() { |
| 1006 | t.Error("got declaration disabled, wanted enabled") |
| 1007 | } |
| 1008 | } |
| 1009 | |
| 1010 | func TestFunctionDeclToExprDecl(t *testing.T) { |
| 1011 | tests := []struct { |
nothing calls this directly
no test coverage detected