MCPcopy
hub / github.com/helm/helm / TestAlterFuncMap_tplfunc

Function TestAlterFuncMap_tplfunc

pkg/engine/engine_test.go:955–982  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

953}
954
955func TestAlterFuncMap_tplfunc(t *testing.T) {
956 c := &chart.Chart{
957 Metadata: &chart.Metadata{Name: "TplFunction"},
958 Templates: []*common.File{
959 {Name: "templates/base", ModTime: time.Now(), Data: []byte(`Evaluate tpl {{tpl "Value: {{ .Values.value | quote}}" .}}`)},
960 },
961 }
962
963 v := common.Values{
964 "Values": common.Values{
965 "value": "myvalue",
966 },
967 "Chart": c.Metadata,
968 "Release": common.Values{
969 "Name": "TestRelease",
970 },
971 }
972
973 out, err := Render(c, v)
974 if err != nil {
975 t.Fatal(err)
976 }
977
978 expect := "Evaluate tpl Value: \"myvalue\""
979 if got := out["TplFunction/templates/base"]; got != expect {
980 t.Errorf("Expected %q, got %q (%v)", expect, got, out)
981 }
982}
983
984func TestAlterFuncMap_tplinclude(t *testing.T) {
985 modTime := time.Now()

Callers

nothing calls this directly

Calls 3

RenderFunction · 0.85
NowMethod · 0.80
FatalMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…