Added WithError(err).

This commit is contained in:
Joern Barthel
2015-05-13 13:35:03 +02:00
parent 52919f182f
commit c24d0555d7
2 changed files with 23 additions and 0 deletions
+15
View File
@@ -8,6 +8,21 @@ import (
"github.com/stretchr/testify/assert"
)
func TestEntryWithError(t *testing.T) {
err := fmt.Errorf("kaboom at layer %d", 4711)
logger := New()
logger.Out = &bytes.Buffer{}
entry := NewEntry(logger)
assert.Equal(t, err, entry.WithError(err).Data["error"])
ErrorKey = "err"
assert.Equal(t, err, entry.WithError(err).Data["err"])
}
func TestEntryPanicln(t *testing.T) {
errBoom := fmt.Errorf("boom time")