mirror of https://github.com/certusone/wasmd.git
26 lines
527 B
Go
26 lines
527 B
Go
package wasmtesting
|
|
|
|
import (
|
|
storetypes "cosmossdk.io/store/types"
|
|
)
|
|
|
|
// MockCommitMultiStore mock with a CacheMultiStore to capture commits
|
|
type MockCommitMultiStore struct {
|
|
storetypes.CommitMultiStore
|
|
Committed []bool
|
|
}
|
|
|
|
func (m *MockCommitMultiStore) CacheMultiStore() storetypes.CacheMultiStore {
|
|
m.Committed = append(m.Committed, false)
|
|
return &mockCMS{m, &m.Committed[len(m.Committed)-1]}
|
|
}
|
|
|
|
type mockCMS struct {
|
|
storetypes.CommitMultiStore
|
|
committed *bool
|
|
}
|
|
|
|
func (m *mockCMS) Write() {
|
|
*m.committed = true
|
|
}
|