src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/testutil/testutil_test.go (about)

     1  package testutil
     2  
     3  type cleanuper struct{ fns []func() }
     4  
     5  func (c *cleanuper) Cleanup(fn func()) { c.fns = append(c.fns, fn) }
     6  
     7  func (c *cleanuper) runCleanups() {
     8  	for i := len(c.fns) - 1; i >= 0; i-- {
     9  		c.fns[i]()
    10  	}
    11  }