Browse Source

Use Cleanup to remove old entries in ts map

pull/2/head
Nise Void 11 months ago
parent
commit
d20ac9444a
Signed by: NiseVoid GPG Key ID: FBA14AC83EA602F3
2 changed files with 5 additions and 0 deletions
  1. +4
    -0
      assert.go
  2. +1
    -0
      type.go

+ 4
- 0
assert.go View File

@ -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
}


+ 1
- 0
type.go View File

@ -4,4 +4,5 @@ package assert
type T interface {
Error(...interface{})
Helper()
Cleanup(func())
}

Loading…
Cancel
Save