diff --git a/libs/template/helpers_test.go b/libs/template/helpers_test.go index fbb66ae2..51c470ef 100644 --- a/libs/template/helpers_test.go +++ b/libs/template/helpers_test.go @@ -2,12 +2,28 @@ package template import ( "context" + "strings" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) +func TestTemplatePrintStringWithoutProcessing(t *testing.T) { + ctx := context.Background() + tmpDir := t.TempDir() + + r, err := newRenderer(ctx, nil, "./testdata/print-without-processing/template", "./testdata/print-without-processing/library", tmpDir) + require.NoError(t, err) + + err = r.walk() + assert.NoError(t, err) + + assert.Len(t, r.files, 1) + cleanContent := strings.Trim(string(r.files[0].content), "\n\r") + assert.Equal(t, `{{ fail "abc" }}`, cleanContent) +} + func TestTemplateRegexpCompileFunction(t *testing.T) { ctx := context.Background() tmpDir := t.TempDir() diff --git a/libs/template/testdata/print-without-processing/template/hello.tmpl b/libs/template/testdata/print-without-processing/template/hello.tmpl new file mode 100644 index 00000000..735d0209 --- /dev/null +++ b/libs/template/testdata/print-without-processing/template/hello.tmpl @@ -0,0 +1 @@ +{{`{{ fail "abc" }}`}}