Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: mock gen #1864

Merged
merged 5 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,7 @@ cover-html: test-unit-cover
$(MOCKS_DIR):
mkdir -p $(MOCKS_DIR)
mocks: $(MOCKS_DIR)
@go install github.com/golang/mock/mockgen@v1.6.0
sh ./scripts/mockgen.sh
sh ./contrib/scripts/mockgen.sh
.PHONY: mocks

###############################################################################
Expand Down
5 changes: 3 additions & 2 deletions contrib/scripts/mockgen.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env sh

mockgen_cmd="mockgen"
# $mockgen_cmd -source=<path/source-file.go -package mock -destination tests/mocks/<dest-package>/<dest-filename.go>
mockgen_cmd="go run github.com/golang/mock/mockgen"

$mockgen_cmd -source ./x/uibc/expected_keepers.go -package mocks -destination ./x/uibc/mocks/keepers.go
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ require (
github.com/cosmos/ibc-go/v5 v5.2.0
github.com/ethereum/go-ethereum v1.11.1
github.com/gogo/protobuf v1.3.3
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.2
github.com/golangci/golangci-lint v1.51.2
github.com/gorilla/mux v1.8.0
Expand Down
7 changes: 7 additions & 0 deletions tests/tools_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package tests

// file to import test / tools dependencies and let the go package manager to manage them.

import (
_ "github.com/golang/mock/gomock"
)
167 changes: 167 additions & 0 deletions x/uibc/mocks/keepers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.