syncthing/lib/scanner
Eng Zer Jun bc27aa12cd
all: use T.TempDir to create temporary test directory (#8280)
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-15 07:44:06 +04:00
..
testdata lib/ignore, lib/scanner: Catch included items below ignored ones (#4811) 2018-05-14 09:47:23 +02:00
.gitignore Add benchmark of HashFile 2015-10-27 09:30:34 +01:00
blockqueue.go lib/scanner: Pass on errors while hashing (#7380) 2021-02-19 08:51:39 +01:00
blocks.go lib/scanner: Allocate structure for final partial block (#7310) 2021-01-28 14:23:24 +01:00
blocks_test.go cmd/ursrv, lib/scanner: Remove unnecessary slicing of slices (#7491) 2021-03-17 21:04:36 +01:00
debug.go all, lib/logger: Refactor SetDebug calls (#6054) 2019-10-04 13:03:34 +02:00
doc.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
virtualfs_test.go lib: Prevent using protocol method with native path (fixes #7557) (#7563) 2021-04-11 15:29:43 +02:00
walk.go lib/scanner: Do not drop all not-exist-errors and debug logging (#7675) 2021-05-15 11:51:35 +02:00
walk_test.go all: use T.TempDir to create temporary test directory (#8280) 2022-04-15 07:44:06 +04:00