Skip to content

Commit

Permalink
Giving up on testing.T.TempDir oof
Browse files Browse the repository at this point in the history
  • Loading branch information
meatballhat committed Jun 18, 2023
1 parent ce360fc commit b7064f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion value_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ type fileValueSource struct {
}

func (f *fileValueSource) Lookup() (string, bool) {
data, err := os.ReadFile(string(f.Path))
data, err := os.ReadFile(f.Path)
return string(data), err == nil
}

Expand Down
4 changes: 2 additions & 2 deletions value_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"math/rand"
"os"
"path/filepath"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -49,10 +50,9 @@ func TestFileSource(t *testing.T) {
func TestFilePaths(t *testing.T) {
r := require.New(t)

fileName := fmt.Sprintf("some_file_name_%[1]v", rand.Int())
fileName := filepath.Join(os.TempDir(), fmt.Sprintf("urfave-cli-tests-some_file_name_%[1]v", rand.Int()))
t.Cleanup(func() { _ = os.Remove(fileName) })

r.Nil(os.Chdir(t.TempDir()))
r.Nil(os.WriteFile(fileName, []byte("Hello"), 0644))

sources := Files("junk_file_name", fileName)
Expand Down

0 comments on commit b7064f9

Please sign in to comment.