diff options
Diffstat (limited to 'error_buffer_test.go')
-rw-r--r-- | error_buffer_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/error_buffer_test.go b/error_buffer_test.go index afbc80e2..aa6a17f2 100644 --- a/error_buffer_test.go +++ b/error_buffer_test.go @@ -12,3 +12,20 @@ func TestErrBuffer_Write_Len(t *testing.T) { assert.Equal(t, 5, buf.Len()) assert.Equal(t, buf.String(), "hello") } + +func TestErrBuffer_Write_Event(t *testing.T) { + buf := &errBuffer{buffer: new(bytes.Buffer)} + + tr := make(chan interface{}) + buf.Listen(func(event int, ctx interface{}) { + assert.Equal(t, EventStderrOutput, event) + assert.Equal(t, []byte("hello"), ctx) + close(tr) + }) + + buf.Write([]byte("hello")) + + <-tr + assert.Equal(t, 5, buf.Len()) + assert.Equal(t, buf.String(), "hello") +} |