source-controller/internal/fs
Eng Zer Jun 10b92da433
test: use `T.TempDir` to create temporary test directory
This commit replaces `os.MkdirTemp` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests complete.

Prior to this commit, temporary directory created using `os.MkdirTemp`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
	defer func() {
		if err := os.RemoveAll(dir); err != nil {
			t.Fatal(err)
		}
	}
is also tedious, but `t.TempDir` handles this for us nicely.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-04-29 23:01:39 +08:00
..
testdata Make storage file writes atomic 2020-09-10 12:02:32 +02:00
LICENSE Make storage file writes atomic 2020-09-10 12:02:32 +02:00
fs.go Drop deprecated `io/ioutil` 2021-07-29 09:58:00 +02:00
fs_test.go test: use `T.TempDir` to create temporary test directory 2022-04-29 23:01:39 +08:00
rename.go Update github.com/libgit2/git2go to v31.6.1 2021-09-30 16:36:20 +02:00
rename_windows.go Update github.com/libgit2/git2go to v31.6.1 2021-09-30 16:36:20 +02:00