-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_test.go
More file actions
47 lines (44 loc) · 824 Bytes
/
debug_test.go
File metadata and controls
47 lines (44 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"os"
"testing"
)
func TestGetDebugStream(t *testing.T) {
t.Run(
"enable debug",
func(t *testing.T) {
stream, err := getDebugStream(true)
if err != nil {
t.Errorf("expected no error, got %v", err)
}
if stream != os.Stdout {
t.Errorf("expected os.Stdout, got %v", stream)
}
},
)
t.Run(
"disable debug",
func(t *testing.T) {
stream, err := getDebugStream(false)
if err != nil {
t.Errorf("expected no error, got %v", err)
}
if stream == os.Stdout {
t.Errorf("expected os.DevNull, got os.Stdout")
}
},
)
}
func TestInitDebugFunc(t *testing.T) {
t.Run(
"test debug func",
func(t *testing.T) {
fp, err := initDebugFunc(true)
if err != nil {
t.Errorf("expected no error, got %v", err)
}
fn := *fp
fn("debug")
},
)
}