Skip to content

Commit

Permalink
fix: file tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ravsii committed Feb 13, 2025
1 parent 93a364d commit c2f1639
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions template/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,19 @@ func TestTemplateMockFuncs(t *testing.T) {
},
{
name: "readFile",
inTemplate: "{{readFile .Mocks}}",
inTemplate: "{{readFile .TemplateData.f}}",
dataInit: func() Data {
f, err := os.CreateTemp(".", "readFileTest")
require.NoError(t, err)

t.Cleanup(func() {
os.Remove(f.Name())
})

_, err = f.WriteString("content")
require.NoError(t, err)

return Data{TemplateData: map[string]any{"f": "readFileTest"}}
return Data{TemplateData: map[string]any{"f": f.Name()}}
},
want: "content",
},
Expand Down

0 comments on commit c2f1639

Please sign in to comment.