zapx: Index | Files

package ztest

import ""

Package ztest provides zap utilities for testing.

TODO: examples


Package Files

doc.go test.go

func AssertEqualFields Uses

func AssertEqualFields(t *testing.T, expected zap.Field, actual zap.Field) bool

AssertEqualFields asserts that two zap.Fields are equal

func AssertObserved Uses

func AssertObserved(t *testing.T, expected []ObservedEntry, observed *observer.ObservedLogs) bool

AssertObserved asserts if the entries given were collected in order. It allows skips (entries in between the expected entries). Messages are asserted based on strings.Contains (not exact match)

func NewObservable Uses

func NewObservable() (*zap.Logger, *observer.ObservedLogs)

NewObservable bootstraps a logger that allows interrogation of output

type ObservedEntry Uses

type ObservedEntry struct {
    Message string
    Fields  map[string]interface{}

ObservedEntry is used for providing assertions on observed logs with AssertObserved()

Package ztest imports 6 packages (graph). Updated 2019-08-24. Refresh now. Tools for package owners.