test: add more tests (#1179)

master
Kevin Wan 3 years ago committed by GitHub
parent 27f553bf84
commit 8230474667
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -58,6 +58,22 @@ func TestLoggerFatalln(t *testing.T) {
assert.Contains(t, builder.String(), content)
}
func TestLoggerInfo(t *testing.T) {
var builder strings.Builder
log.SetOutput(&builder)
logger := new(Logger)
logger.Info(content)
assert.Empty(t, builder.String())
}
func TestLoggerInfof(t *testing.T) {
var builder strings.Builder
log.SetOutput(&builder)
logger := new(Logger)
logger.Infof(content)
assert.Empty(t, builder.String())
}
func TestLoggerWarning(t *testing.T) {
var builder strings.Builder
log.SetOutput(&builder)
@ -66,6 +82,14 @@ func TestLoggerWarning(t *testing.T) {
assert.Empty(t, builder.String())
}
func TestLoggerInfoln(t *testing.T) {
var builder strings.Builder
log.SetOutput(&builder)
logger := new(Logger)
logger.Infoln(content)
assert.Empty(t, builder.String())
}
func TestLoggerWarningf(t *testing.T) {
var builder strings.Builder
log.SetOutput(&builder)
@ -81,3 +105,11 @@ func TestLoggerWarningln(t *testing.T) {
logger.Warningln(content)
assert.Empty(t, builder.String())
}
func TestLogger_V(t *testing.T) {
logger := new(Logger)
// grpclog.fatalLog
assert.True(t, logger.V(3))
// grpclog.infoLog
assert.False(t, logger.V(0))
}

Loading…
Cancel
Save