Skip to content

Commit e472053

Browse files
committed
Adds fctesting.TestWriter
TestWriter allows for mocking along with other functionality, such as syncing when to look at the contents of a writer in the event of goroutines Signed-off-by: xibz <[email protected]>
1 parent eb52953 commit e472053

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

fctesting/test_writer.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package fctesting
2+
3+
// TestWriter is used to mock out writing and/or do other things such as
4+
// syncing when to do assertions in the event that a writer is used in a
5+
// goroutine
6+
type TestWriter struct {
7+
WriteFn func([]byte) (int, error)
8+
}
9+
10+
func (w *TestWriter) Write(b []byte) (int, error) {
11+
return w.WriteFn(b)
12+
}

0 commit comments

Comments
 (0)