Skip to content

Commit

Permalink
Add tests for foreign interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Gohr committed Jun 2, 2018
1 parent c199617 commit 7e4c853
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fixtures/something_remote.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package fixtures

import "github.com/elgohr/counterfeiter/fixtures/aliased_package"

//go:generate counterfeiter . SomethingWithForeignInterface
type SomethingWithForeignInterface interface {
the_aliased_package.InAliasedPackage
}
19 changes: 19 additions & 0 deletions locator/locator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,25 @@ var _ = Describe("Locator", func() {
})
})
})

Describe("finding a foreign interface inside of an interface", func() {
var model *model.InterfaceToFake
var err error

JustBeforeEach(func() {
model, err = GetInterfaceFromFilePath("SomethingWithForeignInterface", "../fixtures/something_remote.go")
Expect(err).NotTo(HaveOccurred())
})

It("returns a model representing the named function alias", func() {
Expect(model.Name).To(Equal("SomethingWithForeignInterface"))
Expect(model.RepresentedByInterface).To(BeTrue())
})

It("should have the remote interface method", func() {
Expect(model.Methods).To(HaveLen(1))
})
})
})

func collectImports(specs map[string]*ast.ImportSpec) []string {
Expand Down

0 comments on commit 7e4c853

Please sign in to comment.