Skip to content

Commit

Permalink
Undoing changes to see why test fail
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpye committed Jan 9, 2024
1 parent cc822c0 commit b2250b7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
7 changes: 0 additions & 7 deletions template.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,6 @@ func templateFuncMap(r *rand.Rand, fm *template.FuncMap) *template.FuncMap {
return args
}

// Fix merge the user function maps with the template function map
if fm != nil {
for k, v := range *fm {
funcMap[k] = v
}
}

return &funcMap
}

Expand Down
19 changes: 0 additions & 19 deletions template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"strings"
"testing"
"text/template"
)

func ExampleTemplate() {
Expand Down Expand Up @@ -46,24 +45,6 @@ func ExampleFaker_Template() {
// Sylvan Mraz
}

func TestUserFunctionMap(t *testing.T) {
f := New(11)

funcMap := template.FuncMap{
"title": strings.Title,
}
s := `{{printf "%q" (title .Data)}}`

value, err := f.Template(s, &TemplateOptions{Funcs: funcMap, Data: "the go programming language"})
if err != nil {
fmt.Println(err)
}
fmt.Println(value)
if value != "\"The Go Programming Language\"" {
t.Error("Expected \"The Go Programming Language\", got ", value)
}
}

func TestTemplate_misc(t *testing.T) {
f := New(11)

Expand Down

0 comments on commit b2250b7

Please sign in to comment.