Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendCtxWithMockLogger ¶
func AppendCtxWithMockLogger(t *testing.T, ctx sdk.Context) (sdk.Context, *sdktestsmocks.MockLogger)
AppendCtxWithMockLogger sets the logger for an input context as a mock logger
with 'EXPECT' statements. This enables testing on functions logged to the context. For example,
```go // This is a passing test example import (
gomock "github.com/golang/mock/gomock" sdktestsmocks "github.com/cosmos/cosmos-sdk/tests/mocks"
)
// assume t is a *testing.T variable. ctx, logger := AppendCtxWithMockLogger(t, ctx) logger.EXPECT().Debug("debug") logger.EXPECT().Info("info") logger.EXPECT().Error("error") ctx.Logger().Debug("debug") ctx.Logger().Info("info") ctx.Logger().Error("error")
```
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.