about summary refs log tree commit diff
path: root/templater/templater_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'templater/templater_test.go')
-rw-r--r--templater/templater_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/templater/templater_test.go b/templater/templater_test.go
index f6b12c758057..2a9ddaa2bb10 100644
--- a/templater/templater_test.go
+++ b/templater/templater_test.go
@@ -162,3 +162,20 @@ func TestFailOnMissingKeys(t *testing.T) {
 		t.Errorf("Templating failed with unexpected error: %v\n", err)
 	}
 }
+
+func TestDefaultTemplateFunction(t *testing.T) {
+	ctx := context.Context{}
+	resourceSet := context.ResourceSet{}
+
+	res, err := templateFile(&ctx, &resourceSet, "testdata/test-default.txt")
+
+	if err != nil {
+		t.Errorf("Templating with default values should have succeeded.\n")
+		t.Fail()
+	}
+
+	if res.Rendered != "defaultValue\n" {
+		t.Error("Result does not contain expected rendered default value.")
+		t.Fail()
+	}
+}