mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
41 lines
502 B
Go
41 lines
502 B
Go
package cleanup
|
|
|
|
import "testing"
|
|
|
|
func badT(t *testing.T) {
|
|
t.Cleanup(func() {
|
|
t.Log("done")
|
|
})
|
|
}
|
|
|
|
func badB(b *testing.B) {
|
|
b.Cleanup(func() {
|
|
b.Log("done")
|
|
})
|
|
}
|
|
|
|
func badTB(tb testing.TB) {
|
|
tb.Cleanup(func() {
|
|
tb.Log("done")
|
|
})
|
|
}
|
|
|
|
func badMultipleRefs(t *testing.T) {
|
|
t.Cleanup(func() {
|
|
t.Log("first")
|
|
t.Log("second")
|
|
})
|
|
}
|
|
|
|
func good(t *testing.T) {
|
|
t.Cleanup(func() {
|
|
println("no capture")
|
|
})
|
|
}
|
|
|
|
func goodNamedFunc(t *testing.T) {
|
|
t.Cleanup(namedFunc)
|
|
}
|
|
|
|
func namedFunc() {}
|