(t *testing.T)
| 27 | } |
| 28 | |
| 29 | func TestNewTemplateByStringWithCustomVars(t *testing.T) { |
| 30 | data := map[string]any{} |
| 31 | vars := ConvertToMap([]string{"Name=John Doe", "Message=Hello"}) |
| 32 | maps.Copy(data, vars) |
| 33 | |
| 34 | expected := "Hello, John Doe! Hello" |
| 35 | |
| 36 | actual, err := NewTemplateByString("Hello, {{.Name}}! {{.Message}}", data) |
| 37 | if err != nil { |
| 38 | t.Errorf("Unexpected error: %v", err) |
| 39 | } |
| 40 | |
| 41 | if actual != expected { |
| 42 | t.Errorf("Expected %q but got %q", expected, actual) |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | func TestProcessTemplate(t *testing.T) { |
| 47 | // Set up test data |
nothing calls this directly
no test coverage detected