mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-28 04:46:44 -04:00
unix: modernize test helpers
Test helper functions mktmpfifo and chtmpdir were written before t.Cleanup was available, which necessitated returning of a cleanup function and the use of defer. Let's use t.Cleanup (available since Go 1.14) and simplify the callers. While at it, - use t.Helper (added in Go 1.9); - simplify some error messages (errors that come from os package usually doesn't need to be wrapped). Change-Id: Id981ae1c85fa2642a76358a31fc18a9af2f78711 Reviewed-on: https://go-review.googlesource.com/c/sys/+/526695 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
committed by
Gopher Robot
parent
a26c6dedca
commit
8d9dcc467b
@@ -60,7 +60,7 @@ func TestTime(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUtime(t *testing.T) {
|
||||
defer chtmpdir(t)()
|
||||
chtmpdir(t)
|
||||
|
||||
touch(t, "file1")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user