(t *testing.T)
| 35 | } |
| 36 | |
| 37 | func TestRegistryAddFuncs(t *testing.T) { |
| 38 | r := NewRegistry() |
| 39 | |
| 40 | r.AddFuncs(map[string]any{ |
| 41 | "test": func(a string) string { return a + "-TEST" }, |
| 42 | }) |
| 43 | |
| 44 | checkRegistryFuncs(t, r, "raw", "test") |
| 45 | |
| 46 | result, err := r.LoadString(`{{.|test}}`).Render("example") |
| 47 | if err != nil { |
| 48 | t.Fatalf("Unexpected Render() error, got %v", err) |
| 49 | } |
| 50 | |
| 51 | expected := "example-TEST" |
| 52 | if result != expected { |
| 53 | t.Fatalf("Expected Render() result %q, got %q", expected, result) |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | func TestRegistryLoadFiles(t *testing.T) { |
| 58 | r := NewRegistry() |
nothing calls this directly
no test coverage detected
searching dependent graphs…