| 456 | } |
| 457 | |
| 458 | func TestParseErrors(t *testing.T) { |
| 459 | vals := common.Values{"Values": map[string]any{}} |
| 460 | |
| 461 | tplsUndefinedFunction := map[string]renderable{ |
| 462 | "undefined_function": {tpl: `{{foo}}`, vals: vals}, |
| 463 | } |
| 464 | _, err := new(Engine).render(tplsUndefinedFunction) |
| 465 | if err == nil { |
| 466 | t.Fatalf("Expected failures while rendering: %s", err) |
| 467 | } |
| 468 | expected := `parse error at (undefined_function:1): function "foo" not defined` |
| 469 | if err.Error() != expected { |
| 470 | t.Errorf("Expected '%s', got %q", expected, err.Error()) |
| 471 | } |
| 472 | } |
| 473 | |
| 474 | func TestExecErrors(t *testing.T) { |
| 475 | vals := common.Values{"Values": map[string]any{}} |