mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-02 23:27:31 -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
@@ -12,9 +12,8 @@ import (
|
||||
)
|
||||
|
||||
func TestPpoll(t *testing.T) {
|
||||
defer chtmpdir(t)()
|
||||
f, cleanup := mktmpfifo(t)
|
||||
defer cleanup()
|
||||
chtmpdir(t)
|
||||
f := mktmpfifo(t)
|
||||
|
||||
const timeout = 100 * time.Millisecond
|
||||
|
||||
|
||||
Reference in New Issue
Block a user