mirror of https://github.com/fluffle/goirc
Fix behaviour of CheckWrittenAtLevel() slightly:
1) Adjust alignments for exp/got correctly. 2) Print expected string when nothing logged at level. 3) Check to ensure no unexpected logging occurred at other levels when nothing logged at expected level.
This commit is contained in:
parent
47dd5b3430
commit
74ef93abde
|
@ -61,7 +61,9 @@ func (m writerMap) CheckWrittenAtLevel(t *testing.T, lv LogLevel, exp string) {
|
|||
// 2011/10/22 10:22:57 log_test.go:<line no>: <level> <log message>
|
||||
if len(w.written) <= 33 {
|
||||
t.Errorf("Not enough bytes logged at level %s:", LogString(lv))
|
||||
t.Errorf("\tgot: %s", string(w.written))
|
||||
t.Errorf("exp: %s\n\tgot: %s", exp, string(w.written))
|
||||
// Check nothing was written to a different log level here, too.
|
||||
m.CheckNothingWritten(t)
|
||||
return
|
||||
}
|
||||
s := string(w.written[32:])
|
||||
|
@ -73,7 +75,7 @@ func (m writerMap) CheckWrittenAtLevel(t *testing.T, lv LogLevel, exp string) {
|
|||
exp = LogString(lv) + " " + exp
|
||||
if s != exp {
|
||||
t.Errorf("Log message at level %s differed.", LogString(lv))
|
||||
t.Errorf("\texp: %s\n\tgot: %s", exp, s)
|
||||
t.Errorf("exp: %s\n\tgot: %s", exp, s)
|
||||
}
|
||||
w.reset()
|
||||
// Calling checkNothingWritten here both tests that w.reset() works
|
||||
|
|
Loading…
Reference in New Issue