syncthing/lib/versioner
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
..
_external_test lib/versioner: Test both spaces and parens in ext versioner paths 2016-09-18 12:24:55 +00:00
.gitignore
debug.go all, lib/logger: Refactor SetDebug calls (#6054) 2019-10-04 13:03:34 +02:00
empty_dir_tracker_test.go lib/versioner: Purge the empty directories in .stversions (fixes #4406) 2017-11-18 15:56:53 +00:00
empty_dir_tracker.go lib/versioner: Purge the empty directories in .stversions (fixes #4406) 2017-11-18 15:56:53 +00:00
external_test.go all: Remove usage of deprecated io/ioutil (#7971) 2021-11-22 08:59:47 +01:00
external.go lib: Get rid of buggy filesystem wrapping (#8257) 2022-04-10 20:55:05 +02:00
simple_test.go all: use T.TempDir to create temporary test directory (#8280) 2022-04-15 07:44:06 +04:00
simple.go lib: Get rid of buggy filesystem wrapping (#8257) 2022-04-10 20:55:05 +02:00
staggered_test.go all: use T.TempDir to create temporary test directory (#8280) 2022-04-15 07:44:06 +04:00
staggered.go lib: Get rid of buggy filesystem wrapping (#8257) 2022-04-10 20:55:05 +02:00
trashcan_test.go all: use T.TempDir to create temporary test directory (#8280) 2022-04-15 07:44:06 +04:00
trashcan.go lib: Get rid of buggy filesystem wrapping (#8257) 2022-04-10 20:55:05 +02:00
util.go lib: Get rid of buggy filesystem wrapping (#8257) 2022-04-10 20:55:05 +02:00
versioner_test.go all: Remove usage of deprecated io/ioutil (#7971) 2021-11-22 08:59:47 +01:00
versioner.go lib/versioner: Improve error messages (fixes #7354) (#7357) 2021-02-12 20:30:51 +01:00