Skip to content

Commit 0b20ff8

Browse files
committed
Forgot to stage poor mock_test
1 parent 331f24c commit 0b20ff8

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

mock_test.go

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package eventually_test
2+
3+
import (
4+
"fmt"
5+
"testing"
6+
)
7+
8+
type test struct {
9+
*testing.T
10+
logs []string
11+
failed bool
12+
halted bool
13+
}
14+
15+
func (t *test) Fail() {
16+
t.failed = true
17+
}
18+
19+
func (t *test) FailNow() {
20+
t.failed = true
21+
t.halted = true
22+
}
23+
24+
func (t *test) Fatal(args ...interface{}) {
25+
t.Log(args...)
26+
t.FailNow()
27+
}
28+
29+
func (t *test) Fatalf(format string, args ...interface{}) {
30+
t.Logf(format, args...)
31+
t.FailNow()
32+
}
33+
34+
func (t *test) Error(args ...interface{}) {
35+
t.Log(args...)
36+
t.Fail()
37+
}
38+
39+
func (t *test) Errorf(format string, args ...interface{}) {
40+
t.Logf(format, args...)
41+
t.Fail()
42+
}
43+
44+
func (t *test) Log(args ...any) {
45+
t.logs = append(t.logs, fmt.Sprintln(args...))
46+
}
47+
48+
func (t *test) Logf(format string, args ...any) {
49+
t.logs = append(t.logs, fmt.Sprintf(format, args...))
50+
}

0 commit comments

Comments
 (0)