Skip to content

Commit

Permalink
Add failing test for two packages in directory
Browse files Browse the repository at this point in the history
  • Loading branch information
colonelpanic8 committed Jun 28, 2016
1 parent 97a72e5 commit b1395a6
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mockery/fixtures/twopackages/one.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package twopackages

type InMainPackage interface{}
7 changes: 7 additions & 0 deletions mockery/fixtures/twopackages/one_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package twopackagestest

import "net/http"

type InterfaceInTestPackage interface {
A() http.File
}
35 changes: 35 additions & 0 deletions mockery/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,41 @@ import mock "github.com/stretchr/testify/mock"
s.checkPrologueGeneration(generator, expected)
}

func (s *GeneratorSuite) TestStillWorksWithMultiplePackagesInDirectory() {
expected := `// InterfaceInTestPackage is an autogenerated mock type for the InterfaceInTestPackage type
type InterfaceInTestPackage struct {
mock.Mock
}
// A provides a mock function with given fields:
func (_m *InterfaceInTestPackage) A() http.File {
ret := _m.Called()
var r0 http.File
if rf, ok := ret.Get(0).(func() http.File); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(http.File)
}
}
return r0
}
`
s.checkGeneration("twopackages/one_test.go", "InterfaceInTestPackage", false, expected)
}

func (s *GeneratorSuite) TestWorksWithMultiplePackagesMainPackage() {
expected := `// InMainPackage is an autogenerated mock type for the InMainPackage type
type InMainPackage struct {
mock.Mock
}
`
s.checkGeneration("twopackages/one.go", "InMainPackage", false, expected)
}

func TestGeneratorSuite(t *testing.T) {
generatorSuite := new(GeneratorSuite)
suite.Run(t, generatorSuite)
Expand Down

0 comments on commit b1395a6

Please sign in to comment.