-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpect_test.go
50 lines (38 loc) · 864 Bytes
/
expect_test.go
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
48
49
50
package surveyexpect_test
import (
"fmt"
"go.nhat.io/surveyexpect"
)
type TestingT struct {
error *surveyexpect.Buffer
log *surveyexpect.Buffer
clean func()
}
func (t *TestingT) Errorf(format string, args ...interface{}) {
_, _ = fmt.Fprintf(t.error, format, args...)
}
func (t *TestingT) Log(args ...interface{}) {
_, _ = fmt.Fprintln(t.log, args...)
}
func (t *TestingT) Logf(format string, args ...interface{}) {
_, _ = fmt.Fprintf(t.log, format, args...)
}
func (t *TestingT) FailNow() {
panic("failed")
}
func (t *TestingT) Cleanup(clean func()) {
t.clean = clean
}
func (t *TestingT) ErrorString() string {
return t.error.String()
}
func (t *TestingT) LogString() string {
return t.log.String()
}
func T() *TestingT {
return &TestingT{
error: new(surveyexpect.Buffer),
log: new(surveyexpect.Buffer),
clean: func() {},
}
}