Skip to content

Commit

Permalink
refactor: 删除不必要的 Assertion.f
Browse files Browse the repository at this point in the history
  • Loading branch information
caixw committed Feb 27, 2024
1 parent d6443e7 commit 2244555
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions assertion.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
type Assertion struct {
tb testing.TB
print func(...interface{})
f FailureSprintFunc
}

// New 返回 [Assertion] 对象
Expand All @@ -35,7 +34,6 @@ func New(tb testing.TB, fatal bool) *Assertion {
return &Assertion{
tb: tb,
print: p,
f: failureSprint,
}
}

Expand All @@ -57,7 +55,7 @@ func NewWithEnv(tb testing.TB, fatal bool, env map[string]string) *Assertion {
func (a *Assertion) Assert(expr bool, f *Failure) *Assertion {
if !expr {
a.TB().Helper()
a.print(a.f(f))
a.print(GetFailureSprintFunc()(f))
}
failurePool.Put(f)
return a
Expand Down

0 comments on commit 2244555

Please sign in to comment.