diff options
author | Wolfy-J <[email protected]> | 2018-07-08 20:38:01 -0700 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-07-08 20:38:01 -0700 |
commit | dafe0c3f4877c25157b5df4ca69eb23df248ab7a (patch) | |
tree | c3796aea78bb489cb06fa5da846196a178fe5df9 /error_buffer_test.go | |
parent | 9f59155c781f0178e52c53abd2b437d40c51a52d (diff) |
better error buffer
Diffstat (limited to 'error_buffer_test.go')
-rw-r--r-- | error_buffer_test.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/error_buffer_test.go b/error_buffer_test.go index 09ea4f03..81107935 100644 --- a/error_buffer_test.go +++ b/error_buffer_test.go @@ -30,8 +30,7 @@ func TestErrBuffer_Write_Event(t *testing.T) { <-tr // messages are read - assert.Equal(t, 6, buf.Len()) - assert.Equal(t, "hello\n", buf.String()) + assert.Equal(t, 0, buf.Len()) } func TestErrBuffer_Write_Event_Separated(t *testing.T) { @@ -50,6 +49,18 @@ func TestErrBuffer_Write_Event_Separated(t *testing.T) { buf.Write([]byte("ending")) <-tr + assert.Equal(t, 0, buf.Len()) + assert.Equal(t, "", buf.String()) +} + +func TestErrBuffer_Write_Event_Separated_NoListener(t *testing.T) { + buf := newErrBuffer() + defer buf.Close() + + buf.Write([]byte("hel")) + buf.Write([]byte("lo\n")) + buf.Write([]byte("ending")) + assert.Equal(t, 12, buf.Len()) assert.Equal(t, "hello\nending", buf.String()) } |