Skip to content

Commit

Permalink
Update test code.
Browse files Browse the repository at this point in the history
  • Loading branch information
googollee committed Jul 24, 2024
1 parent 19abcf9 commit 9808f16
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions log/log_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@ func captureStderr(t *testing.T, f func(t *testing.T)) string {
if err != nil {
t.Fatal("create pipe error:", err)
}
defer func() {
r.Close()
}()

orig := os.Stderr
os.Stderr = w

defer func() {
os.Stderr = orig
w.Close()
}()

f(t)
func() {
defer func() {
os.Stderr = orig
w.Close()
}()

w.Close()
f(t)
}()

out, err := io.ReadAll(r)
if err != nil {
Expand Down

0 comments on commit 9808f16

Please sign in to comment.