From 31a3a7c84bf6972c4b5f371cbe916b55a64d7325 Mon Sep 17 00:00:00 2001 From: Dan Kegel Date: Sun, 13 Feb 2022 09:56:21 -0800 Subject: [PATCH] os: testTempDir: now that we have os.ReadDir, bring back one use of it in a test --- src/testing/testing_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/testing/testing_test.go b/src/testing/testing_test.go index 36c1a396..91816b63 100644 --- a/src/testing/testing_test.go +++ b/src/testing/testing_test.go @@ -119,6 +119,13 @@ func testTempDir(t *testing.T) { if !fi.IsDir() { t.Errorf("dir %q is not a dir", dir) } + files, err := os.ReadDir(dir) + if err != nil { + t.Fatal(err) + } + if len(files) > 0 { + t.Errorf("unexpected %d files in TempDir: %v", len(files), files) + } glob := filepath.Join(dir, "*.txt") if _, err := filepath.Glob(glob); err != nil {