Skip to content

Commit

Permalink
Comment on TestData
Browse files Browse the repository at this point in the history
  • Loading branch information
denik committed Dec 20, 2024
1 parent 418564a commit 7434589
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/testutil/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ func Chdir(t TestingT, dir string) string {
return wd
}

// Helper to get absolute path to testdata file.
// It only able to helps if case Chdir() above was called or directory was not changed at all.
// Return filename ff testutil.Chdir was not called.
// Return absolute path to filename testutil.Chdir() was called.
func TestData(filename string) string {
// Note, if TESTS_ORIG_WD is not set, Getenv return "" and Join returns filename
return filepath.Join(os.Getenv("TESTS_ORIG_WD"), filename)
}

0 comments on commit 7434589

Please sign in to comment.