diff --git a/mock_test.go b/mock_test.go new file mode 100644 index 0000000..4e44486 --- /dev/null +++ b/mock_test.go @@ -0,0 +1,50 @@ +package eventually_test + +import ( + "fmt" + "testing" +) + +type test struct { + *testing.T + logs []string + failed bool + halted bool +} + +func (t *test) Fail() { + t.failed = true +} + +func (t *test) FailNow() { + t.failed = true + t.halted = true +} + +func (t *test) Fatal(args ...interface{}) { + t.Log(args...) + t.FailNow() +} + +func (t *test) Fatalf(format string, args ...interface{}) { + t.Logf(format, args...) + t.FailNow() +} + +func (t *test) Error(args ...interface{}) { + t.Log(args...) + t.Fail() +} + +func (t *test) Errorf(format string, args ...interface{}) { + t.Logf(format, args...) + t.Fail() +} + +func (t *test) Log(args ...any) { + t.logs = append(t.logs, fmt.Sprintln(args...)) +} + +func (t *test) Logf(format string, args ...any) { + t.logs = append(t.logs, fmt.Sprintf(format, args...)) +}