-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #2. Generate mocks for dependent interfaces.
- Loading branch information
Showing
19 changed files
with
499 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package mocks | ||
|
||
// Auto-generated by Mockhiato | ||
import ( | ||
mock "github.com/stretchr/testify/mock" | ||
) | ||
|
||
// errorMock implements mocks.error | ||
type errorMock struct{ mock.Mock } | ||
|
||
// Error implements (mocks.error).Error | ||
func (r *errorMock) Error() string { | ||
ret := r.Called() | ||
var ret0 string | ||
if a := ret.Get(0); a != nil { | ||
ret0 = a.(string) | ||
} | ||
return ret0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package example | ||
|
||
import ( | ||
"os" | ||
|
||
"gitgud.com/bigdot" | ||
) | ||
|
||
// Target is an interface that should be mocked. | ||
type Target interface { | ||
// Should generate mocks for dependent interfaces in /mocks | ||
GoInterface(fi os.FileInfo) (err error) | ||
VendorInterface(bigdot.VendorDep) | ||
|
||
// Should not identify B as dependent interface and generate mocks in /mocks | ||
DefineAndUse(B) | ||
} | ||
|
||
// B B | ||
type B interface{} |
9 changes: 9 additions & 0 deletions
9
lib/generate/test/dependent_interface/actual/vendor/gitgud.com/bigdot/vendor.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package example | ||
|
||
import ( | ||
"os" | ||
|
||
"gitgud.com/bigdot" | ||
) | ||
|
||
// Target is an interface that should be mocked. | ||
type Target interface { | ||
// Should generate mocks for dependent interfaces in /mocks | ||
GoInterface(fi os.FileInfo) (err error) | ||
VendorInterface(bigdot.VendorDep) | ||
|
||
// Should not identify B as dependent interface and generate mocks in /mocks | ||
DefineAndUse(B) | ||
} | ||
|
||
// B B | ||
type B interface{} |
36 changes: 36 additions & 0 deletions
36
lib/generate/test/dependent_interface/expect/mockhiato_mocks.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package example | ||
|
||
// Auto-generated by Mockhiato | ||
import ( | ||
bigdot "gitgud.com/bigdot" | ||
mock "github.com/stretchr/testify/mock" | ||
os "os" | ||
) | ||
|
||
// BMock implements example.B | ||
type BMock struct{ mock.Mock } | ||
|
||
// TargetMock implements example.Target | ||
type TargetMock struct{ mock.Mock } | ||
|
||
// DefineAndUse implements (example.Target).DefineAndUse | ||
func (r *TargetMock) DefineAndUse(p0 B) { | ||
r.Called(p0) | ||
return | ||
} | ||
|
||
// GoInterface implements (example.Target).GoInterface | ||
func (r *TargetMock) GoInterface(p0 os.FileInfo) error { | ||
ret := r.Called(p0) | ||
var ret0 error | ||
if a := ret.Get(0); a != nil { | ||
ret0 = a.(error) | ||
} | ||
return ret0 | ||
} | ||
|
||
// VendorInterface implements (example.Target).VendorInterface | ||
func (r *TargetMock) VendorInterface(p0 bigdot.VendorDep) { | ||
r.Called(p0) | ||
return | ||
} |
Oops, something went wrong.