| 953 | } |
| 954 | |
| 955 | func 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 | |
| 984 | func TestAlterFuncMap_tplinclude(t *testing.T) { |
| 985 | modTime := time.Now() |