(t *testing.T)
| 1019 | } |
| 1020 | |
| 1021 | func TestReducerCollectToMapErrors(t *testing.T) { |
| 1022 | tests := []struct { |
| 1023 | name string |
| 1024 | args []ast.BaseTerm |
| 1025 | expectedErr string |
| 1026 | }{ |
| 1027 | { |
| 1028 | name: "wrong number of arguments - too few", |
| 1029 | args: []ast.BaseTerm{ast.Variable{"X0"}}, |
| 1030 | expectedErr: "collect_to_map requires exactly 2 arguments (key, value), got 1", |
| 1031 | }, |
| 1032 | { |
| 1033 | name: "wrong number of arguments - too many", |
| 1034 | args: []ast.BaseTerm{ast.Variable{"X0"}, ast.Variable{"X1"}, ast.Variable{"X2"}}, |
| 1035 | expectedErr: "collect_to_map requires exactly 2 arguments (key, value), got 3", |
| 1036 | }, |
| 1037 | } |
| 1038 | |
| 1039 | for _, test := range tests { |
| 1040 | t.Run(test.name, func(t *testing.T) { |
| 1041 | expr := ast.ApplyFn{symbols.CollectToMap, test.args} |
| 1042 | var rows []ast.ConstSubstList // empty rows |
| 1043 | _, err := EvalReduceFn(expr, rows) |
| 1044 | if err == nil { |
| 1045 | t.Errorf("Expected error, but got none") |
| 1046 | } else if err.Error() != test.expectedErr { |
| 1047 | t.Errorf("Expected error %q, got %q", test.expectedErr, err.Error()) |
| 1048 | } |
| 1049 | }) |
| 1050 | } |
| 1051 | } |
| 1052 | |
| 1053 | func TestTimeNow(t *testing.T) { |
| 1054 | expr := ast.ApplyFn{symbols.TimeNow, nil} |
nothing calls this directly
no test coverage detected