Use Cleanup to remove old entries in ts map
This commit is contained in:
parent
fe8a28286e
commit
d20ac9444a
2 changed files with 5 additions and 0 deletions
|
@ -24,6 +24,10 @@ func New(t T) Assert {
|
|||
f := runtime.FuncForPC(reflect.ValueOf(a).Pointer())
|
||||
ts[f] = t
|
||||
|
||||
t.Cleanup(func() {
|
||||
delete(ts, f)
|
||||
})
|
||||
|
||||
return a
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue