(t *testing.T)
| 31 | } |
| 32 | |
| 33 | func TestAddTemplateFunctions(t *testing.T) { |
| 34 | AddTemplateFunc("t", func() bool { return true }) |
| 35 | AddTemplateFuncs(template.FuncMap{ |
| 36 | "f": func() bool { return false }, |
| 37 | "h": func() string { return "Hello," }, |
| 38 | "w": func() string { return "world." }}) |
| 39 | |
| 40 | c := &Command{} |
| 41 | c.SetUsageTemplate(`{{if t}}{{h}}{{end}}{{if f}}{{h}}{{end}} {{w}}`) |
| 42 | |
| 43 | const expected = "Hello, world." |
| 44 | if got := c.UsageString(); got != expected { |
| 45 | t.Errorf("Expected UsageString: %v\nGot: %v", expected, got) |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | func TestLevenshteinDistance(t *testing.T) { |
| 50 | tests := []struct { |
nothing calls this directly
no test coverage detected