Improve test coverage for logger

This commit is contained in:
Max Claus Nunes 2018-07-22 10:56:23 -03:00
parent dba823c23b
commit be4160275a
2 changed files with 39 additions and 0 deletions

39
logger_test.go Normal file
View File

@ -0,0 +1,39 @@
package gaper
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestLoggerDefault(t *testing.T) {
l := NewLogger("gaper-test")
assert.Equal(t, l.verbose, false)
}
func TestLoggerEnableVerbose(t *testing.T) {
l := NewLogger("gaper-test")
l.Verbose(true)
assert.Equal(t, l.verbose, true)
}
func TestLoggerRunAllLogsWithoutVerbose(t *testing.T) {
// no asserts, just checking it doesn't crash
l := NewLogger("gaper-test")
l.Debug("debug")
l.Debugf("%s", "debug")
l.Info("info")
l.Error("error")
l.Errorf("%s", "error")
}
func TestLoggerRunAllLogsWithVerbose(t *testing.T) {
// no asserts, just checking it doesn't crash
l := NewLogger("gaper-test")
l.Verbose(true)
l.Debug("debug")
l.Debugf("%s", "debug")
l.Info("info")
l.Error("error")
l.Errorf("%s", "error")
}