|
|
@ -289,7 +289,7 @@ func TestExecErrors(t *testing.T) {
|
|
|
|
func TestFailErrors(t *testing.T) {
|
|
|
|
func TestFailErrors(t *testing.T) {
|
|
|
|
vals := chartutil.Values{"Values": map[string]interface{}{}}
|
|
|
|
vals := chartutil.Values{"Values": map[string]interface{}{}}
|
|
|
|
|
|
|
|
|
|
|
|
failtpl := `{{ fail "This is an error" }}`
|
|
|
|
failtpl := `All your base are belong to us{{ fail "This is an error" }}`
|
|
|
|
tplsFailed := map[string]renderable{
|
|
|
|
tplsFailed := map[string]renderable{
|
|
|
|
"failtpl": {tpl: failtpl, vals: vals},
|
|
|
|
"failtpl": {tpl: failtpl, vals: vals},
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -301,6 +301,18 @@ func TestFailErrors(t *testing.T) {
|
|
|
|
if err.Error() != expected {
|
|
|
|
if err.Error() != expected {
|
|
|
|
t.Errorf("Expected '%s', got %q", expected, err.Error())
|
|
|
|
t.Errorf("Expected '%s', got %q", expected, err.Error())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var e Engine
|
|
|
|
|
|
|
|
e.LintMode = true
|
|
|
|
|
|
|
|
out, err := e.render(tplsFailed)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
t.Fatal(err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expectStr := "All your base are belong to us"
|
|
|
|
|
|
|
|
if gotStr := out["failtpl"]; gotStr != expectStr {
|
|
|
|
|
|
|
|
t.Errorf("Expected %q, got %q (%v)", expectStr, gotStr, out)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestAllTemplates(t *testing.T) {
|
|
|
|
func TestAllTemplates(t *testing.T) {
|
|
|
|