package reportbuf import ( "os" "time" ) // Flush writes the buffered reports to a file now, as the periodic // flush does, so tests need not wait a minute for it. func (b *Buffer) Flush() error { return b.flushLocked() } // StopClock makes every report file the buffer writes from now on // carry the timestamp at, as if all were written in one millisecond. func (b *Buffer) StopClock(at time.Time) { b.now = func() time.Time { return at } } // OnFileCreated makes the buffer call fn with each report file it // writes from now on, once the file is created and before anything is // written to it. func (b *Buffer) OnFileCreated(fn func(f *os.File)) { b.fileCreated = fn }