diff options
| author | Kir Kolyshkin <kolyshkin@gmail.com> | 2023-09-07 17:21:16 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-09-04 00:52:28 +0000 |
| commit | a00195d304e6858406c6c9c961d253eeb8cb0aec (patch) | |
| tree | 149e38fa97607ff78dcc037f449925a85033854c /src/os/exec/exec_test.go | |
| parent | debfcb5ad87b276318bd6b725797e6808adeeae0 (diff) | |
| download | go-a00195d304e6858406c6c9c961d253eeb8cb0aec.tar.xz | |
all: use t.Chdir in tests
Change-Id: I5bc514bedeb1155e6db52e37736fd6101774aea0
Reviewed-on: https://go-review.googlesource.com/c/go/+/529896
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/os/exec/exec_test.go')
| -rw-r--r-- | src/os/exec/exec_test.go | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/src/os/exec/exec_test.go b/src/os/exec/exec_test.go index fd185cadcf..8c62387193 100644 --- a/src/os/exec/exec_test.go +++ b/src/os/exec/exec_test.go @@ -169,28 +169,6 @@ func helperCommandContext(t *testing.T, ctx context.Context, name string, args . return cmd } -func chdir(t *testing.T, dir string) { - t.Helper() - - prev, err := os.Getwd() - if err != nil { - t.Fatal(err) - } - if err := os.Chdir(dir); err != nil { - t.Fatal(err) - } - t.Logf("Chdir(%#q)", dir) - - t.Cleanup(func() { - if err := os.Chdir(prev); err != nil { - // Couldn't chdir back to the original working directory. - // panic instead of t.Fatal so that we don't run other tests - // in an unexpected location. - panic("couldn't restore working directory: " + err.Error()) - } - }) -} - var helperCommandUsed sync.Map var helperCommands = map[string]func(...string){ |
