Skip to content

Commit

Permalink
Adds InterfaceNameLower as a templating variable
Browse files Browse the repository at this point in the history
Signed-off-by: hohmannr <raphael.hohmann@tuta.io>
  • Loading branch information
hohmannr committed Jul 11, 2023
1 parent b5592d6 commit 5e1ff90
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/outputter.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ func parseConfigTemplates(ctx context.Context, c *config.Config, iface *Interfac
InterfaceNameCamel string
InterfaceNameLowerCamel string
InterfaceNameSnake string
InterfaceNameLower string
Mock string
MockName string
PackageName string
Expand All @@ -217,6 +218,7 @@ func parseConfigTemplates(ctx context.Context, c *config.Config, iface *Interfac
InterfaceNameCamel: strcase.ToCamel(iface.Name),
InterfaceNameLowerCamel: strcase.ToLowerCamel(iface.Name),
InterfaceNameSnake: strcase.ToSnake(iface.Name),
InterfaceNameLower: strings.ToLower(iface.Name),
Mock: mock,
MockName: c.MockName,
PackageName: iface.Pkg.Name(),
Expand Down
4 changes: 2 additions & 2 deletions pkg/outputter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func Test_parseConfigTemplates(t *testing.T) {
args: args{
c: &config.Config{
Dir: "{{.InterfaceDir}}/{{.PackagePath}}",
FileName: "{{.InterfaceName}}_{{.InterfaceNameCamel}}_{{.InterfaceNameSnake}}.go",
FileName: "{{.InterfaceName}}_{{.InterfaceNameCamel}}_{{.InterfaceNameSnake}}_{{.InterfaceNameLower}}.go",
MockName: "{{.InterfaceNameLowerCamel}}",
Outpkg: "{{.PackageName}}",
},
Expand All @@ -110,7 +110,7 @@ func Test_parseConfigTemplates(t *testing.T) {
pkg: mockPkg,
want: &config.Config{
Dir: "path/to/github.com/user/project/package",
FileName: "FooBar_FooBar_foo_bar.go",
FileName: "FooBar_FooBar_foo_bar_foobar.go",
MockName: "fooBar",
Outpkg: "packageName",
},
Expand Down

0 comments on commit 5e1ff90

Please sign in to comment.