34 lines
511 B
Go
34 lines
511 B
Go
package sprigx
|
|
|
|
import (
|
|
`bytes`
|
|
_ "embed"
|
|
"testing"
|
|
`text/template`
|
|
|
|
"github.com/Masterminds/sprig/v3"
|
|
)
|
|
|
|
var (
|
|
//go:embed "_test.tpl"
|
|
testTplBytes []byte
|
|
testTpl *template.Template = template.Must(
|
|
template.
|
|
New("").
|
|
Funcs(sprig.TxtFuncMap()).
|
|
Funcs(TxtFuncMap()).
|
|
Parse(string(testTplBytes)),
|
|
)
|
|
)
|
|
|
|
func TestFuncs(t *testing.T) {
|
|
|
|
var err error
|
|
var buf *bytes.Buffer = new(bytes.Buffer)
|
|
|
|
if err = testTpl.Execute(buf, nil); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(buf.String())
|
|
}
|