Skip to content

Commit

Permalink
add a separate test
Browse files Browse the repository at this point in the history
  • Loading branch information
jokly committed Sep 1, 2023
1 parent 73a6a6f commit 09e78f7
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 46 deletions.
4 changes: 4 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ packages:
unroll-variadic: False
- mockname: Expecter
unroll-variadic: True
VariadicNoReturnInterface:
config:
with-expecter: True
unroll-variadic: False
RequesterReturnElided:
github.com/vektra/mockery/v2/pkg/fixtures/recursive_generation:
config:
Expand Down

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

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

3 changes: 3 additions & 0 deletions pkg/fixtures/expecter.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@ type Expecter interface {
ManyArgsReturns(str string, i int) (strs []string, err error)
Variadic(ints ...int) error
VariadicMany(i int, a string, intfs ...interface{}) error
}

type VariadicNoReturnInterface interface {
VariadicNoReturn(j int, is ...interface{})
}
16 changes: 16 additions & 0 deletions pkg/generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,22 @@ func (s *GeneratorSuite) TestGeneratorExpecterWithRolledVariadic() {
)
}

func (s *GeneratorSuite) TestGeneratorVariadicNoReturn() {
expectedBytes, err := os.ReadFile(getMocksPath("VariadicNoReturnInterface.go"))
s.Require().NoError(err)

expected := string(expectedBytes)
expected = expected[strings.Index(expected, "// VariadicNoReturnInterface is"):]

cfg := GeneratorConfig{
StructName: "VariadicNoReturnInterface",
WithExpecter: true,
UnrollVariadic: false,
}

s.checkGenerationWithConfig("expecter.go", "VariadicNoReturnInterface", cfg, expected)
}

func (s *GeneratorSuite) TestGeneratorFunction() {
s.checkGeneration("function.go", "SendFunc", false, "", "")
}
Expand Down

0 comments on commit 09e78f7

Please sign in to comment.