Skip to content

Commit

Permalink
test(main_test): mark createTempFile as a test helper
Browse files Browse the repository at this point in the history
This also marks createTempFile as a helper, so when it fails, the error message will indicate the line in the test function that called it, rather than inside the helper itself. This makes debugging easier.

Co-authored-by: ccoVeille <[email protected]>
  • Loading branch information
supitsdu and ccoVeille authored Jun 25, 2024
1 parent f24438f commit 003d027
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ func stringPtr(s string) *string {

// createTempFile creates a temporary file for testing purposes and writes the given content to it.
func createTempFile(t *testing.T, content string) *os.File {
t.Helper ()
// Create a temporary file
file, err := os.CreateTemp(t.TempDir(), "testfile")
if err != nil {
Expand Down

0 comments on commit 003d027

Please sign in to comment.