mirror of https://github.com/docker/docs.git
20 lines
529 B
Go
20 lines
529 B
Go
package log
|
|
|
|
import "testing"
|
|
|
|
func TestStandardLoggerWithFields(t *testing.T) {
|
|
logger := StandardLogger{}
|
|
withFieldsLogger := logger.WithFields(Fields{
|
|
"foo": "bar",
|
|
"spam": "eggs",
|
|
})
|
|
withFieldsStandardLogger, ok := withFieldsLogger.(StandardLogger)
|
|
if !ok {
|
|
t.Fatal("Type assertion to StandardLogger failed")
|
|
}
|
|
expectedOutFields := "\t\t foo=bar spam=eggs"
|
|
if withFieldsStandardLogger.fieldOut != expectedOutFields {
|
|
t.Fatalf("Expected %q, got %q", expectedOutFields, withFieldsStandardLogger.fieldOut)
|
|
}
|
|
}
|