mirror of https://github.com/golang/go.git
os: add missing calls to Root.Close() in tests
In tests of os.Root, fix a few missing calls to Close(). Change-Id: I8fddd5468394f41d7e92741579fd47f90203ff9f Reviewed-on: https://go-review.googlesource.com/c/go/+/655337 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Damien Neil <dneil@google.com> Auto-Submit: Damien Neil <dneil@google.com>
This commit is contained in:
parent
1cf6b50263
commit
9bd2160790
|
|
@ -3199,6 +3199,7 @@ func TestRootDirFS(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer r.Close()
|
||||
testDirFS(t, r.FS())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -539,17 +539,19 @@ func TestRootOpenFileAsRoot(t *testing.T) {
|
|||
if err := os.WriteFile(target, nil, 0o666); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, err := os.OpenRoot(target)
|
||||
r, err := os.OpenRoot(target)
|
||||
if err == nil {
|
||||
r.Close()
|
||||
t.Fatal("os.OpenRoot(file) succeeded; want failure")
|
||||
}
|
||||
r, err := os.OpenRoot(dir)
|
||||
r, err = os.OpenRoot(dir)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer r.Close()
|
||||
_, err = r.OpenRoot("target")
|
||||
rr, err := r.OpenRoot("target")
|
||||
if err == nil {
|
||||
rr.Close()
|
||||
t.Fatal("Root.OpenRoot(file) succeeded; want failure")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue