recorder.go

 1package test
 2
 3import (
 4	"fmt"
 5	"testing"
 6)
 7
 8type recorder struct {
 9	testing.TB
10	fail  func(string)
11	fatal func(string)
12}
13
14func (r *recorder) Errorf(format string, args ...any) {
15	r.fail(fmt.Sprintf(format, args...))
16}
17
18func (r *recorder) Fatalf(format string, args ...any) {
19	r.fatal(fmt.Sprintf(format, args...))
20}
21
22func (r *recorder) Fatal(args ...any) {
23	r.fatal(fmt.Sprint(args...))
24}
25
26func (r *recorder) Error(args ...any) {
27	r.fail(fmt.Sprint(args...))
28}