This repository was archived by the owner on Jun 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 12 files changed +176
-12
lines changed
internal/tests/overlapping_methods Expand file tree Collapse file tree 12 files changed +176
-12
lines changed Original file line number Diff line number Diff line change 4747 ./ci/check_panic_handling.sh
4848
4949 - name : Run Go tests
50- run : go test -v ./...
50+ run : |
51+ for i in $(find $PWD -name go.mod); do
52+ pushd $(dirname $i)
53+ go test ./...
54+ popd
55+ done
Original file line number Diff line number Diff line change @@ -18,7 +18,13 @@ trap cleanup EXIT
1818
1919cp -r . " ${TEMP_DIR} /"
2020cd $TEMP_DIR
21- go generate ./...
21+
22+ for i in $( find $PWD -name go.mod) ; do
23+ pushd $( dirname $i )
24+ go generate ./...
25+ popd
26+ done
27+
2228if ! diff -r . " ${BASE_DIR} " ; then
2329 echo
2430 echo " The generated files aren't up to date."
Original file line number Diff line number Diff line change 33
44set -euo pipefail
55
6- go mod tidy
6+ for i in $( find $PWD -name go.mod) ; do
7+ pushd $( dirname $i )
8+ go mod tidy
9+ popd
10+ done
711
812if [ ! -z " $( git status --porcelain) " ]; then
913 git status
Original file line number Diff line number Diff line change 1+ module github.com/golang/mock/mockgen/internal/tests/overlapping_methods
2+
3+ go 1.14
4+
5+ require github.com/golang/mock v1.4.4
Original file line number Diff line number Diff line change 1+ github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc =
2+ github.com/golang/mock v1.4.4 /go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4 =
3+ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 /go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w =
4+ golang.org/x/net v0.0.0-20190311183353-d8887717615a /go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg =
5+ golang.org/x/sync v0.0.0-20190423024810-112230192c58 /go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM =
6+ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a /go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY =
7+ golang.org/x/text v0.3.0 /go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ =
8+ golang.org/x/tools v0.0.0-20190425150028-36563e24a262 /go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q =
Original file line number Diff line number Diff line change 1+ // +build go1.14
2+
3+ package overlap
4+
5+ type ReadCloser interface {
6+ Read ([]byte ) (int , error )
7+ Close () error
8+ }
9+
10+ type WriteCloser interface {
11+ Write ([]byte ) (int , error )
12+ Close () error
13+ }
Original file line number Diff line number Diff line change 1+ // +build go1.14
2+
3+ package overlap
4+
5+ //go:generate mockgen -package overlap -destination mock.go -source overlap.go -aux_files github.com/golang/mock/mockgen/internal/tests/overlapping_methods=interfaces.go
6+ type ReadWriteCloser interface {
7+ ReadCloser
8+ WriteCloser
9+ }
Original file line number Diff line number Diff line change 1+ // +build go1.14
2+
3+ package overlap
4+
5+ import (
6+ "errors"
7+ "testing"
8+
9+ gomock "github.com/golang/mock/gomock"
10+ )
11+
12+ // TestValidInterface assesses whether or not the generated mock is valid
13+ func TestValidInterface (t * testing.T ) {
14+ ctrl := gomock .NewController (t )
15+ defer ctrl .Finish ()
16+
17+ s := NewMockReadWriteCloser (ctrl )
18+ s .EXPECT ().Close ().Return (errors .New ("test" ))
19+
20+ s .Close ()
21+ }
Original file line number Diff line number Diff line change @@ -237,10 +237,12 @@ func TestGenerateMockInterface_Helper(t *testing.T) {
237237 }
238238 }
239239
240- if err := g .GenerateMockInterface (& model.Interface {
241- Name : "Somename" ,
242- Methods : test .Methods ,
243- }, "somepackage" ); err != nil {
240+ intf := & model.Interface {Name : "Somename" }
241+ for _ , m := range test .Methods {
242+ intf .AddMethod (m )
243+ }
244+
245+ if err := g .GenerateMockInterface (intf , "somepackage" ); err != nil {
244246 t .Fatal (err )
245247 }
246248
You can’t perform that action at this time.
0 commit comments