Skip to content

Commit

Permalink
Improve test coverage for logger
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcnunes committed Jul 22, 2018
1 parent dba823c commit be41602
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
File renamed without changes.
39 changes: 39 additions & 0 deletions logger_test.go
Original file line number Diff line number Diff line change
@@ -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")
}

0 comments on commit be41602

Please sign in to comment.