MCPcopy
hub / github.com/cweill/gotests / New

Function New

internal/render/render.go:25–43  ·  view source on GitHub ↗

New creates a new Render instance with default templates and helper functions.

()

Source from the content-addressed store, hash-verified

23
24// New creates a new Render instance with default templates and helper functions.
25func New() *Render {
26 r := Render{
27 tmpls: template.New("render").Funcs(map[string]interface{}{
28 "Field": fieldName,
29 "Receiver": receiverName,
30 "Param": parameterName,
31 "Want": wantName,
32 "Got": gotName,
33 "TypeArgs": typeArguments,
34 "FieldType": fieldType,
35 "ReceiverType": receiverType,
36 }),
37 }
38
39 // default templates first
40 r.tmpls = template.Must(r.tmpls.ParseFS(data, "templates/*.tmpl"))
41
42 return &r
43}
44
45// LoadCustomTemplates allows to load in custom templates from a specified path.
46func (r *Render) LoadCustomTemplates(dir string) error {

Callers 9

ProcessMethod · 0.92
TestNewFunction · 0.85
TestRender_LoadFromDataFunction · 0.85
TestRender_HeaderFunction · 0.85
TestRender_TestFunctionFunction · 0.85

Calls

no outgoing calls