Skip to content

Commit

Permalink
Fix path handling in a unit test.
Browse files Browse the repository at this point in the history
Writing files to "." works fine if you are testing locally, but a test built
from another module is run in a read-only directory. This was a bug in the
test, not in the code under test.
  • Loading branch information
creachadair committed Aug 21, 2024
1 parent 0e66780 commit 3ef1948
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions atomicfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ func TestDeferredCancel(t *testing.T) {

func TestSameDirectory(t *testing.T) {
tmp := t.TempDir()
if err := os.Chdir(tmp); err != nil {
t.Fatalf("Chdir: %v", err)
}

f, err := atomicfile.New("xyzzy", 0644)
if err != nil {
Expand Down

0 comments on commit 3ef1948

Please sign in to comment.