diff --git a/pkg/outputter.go b/pkg/outputter.go index 1960be9b..d35653bc 100644 --- a/pkg/outputter.go +++ b/pkg/outputter.go @@ -210,6 +210,7 @@ func parseConfigTemplates(ctx context.Context, c *config.Config, iface *Interfac data := struct { InterfaceDir string InterfaceDirRelative string + InterfaceFile string InterfaceName string InterfaceNameCamel string InterfaceNameLowerCamel string @@ -222,6 +223,7 @@ func parseConfigTemplates(ctx context.Context, c *config.Config, iface *Interfac }{ InterfaceDir: filepath.Dir(iface.FileName), InterfaceDirRelative: interfaceDirRelative, + InterfaceFile: iface.FileName, InterfaceName: iface.Name, // Deprecated: All custom case variables of InterfaceName will be removed in the next major version // Use the template functions instead diff --git a/pkg/outputter_test.go b/pkg/outputter_test.go index 8c7b860c..5e21d821 100644 --- a/pkg/outputter_test.go +++ b/pkg/outputter_test.go @@ -97,7 +97,7 @@ func Test_parseConfigTemplates(t *testing.T) { args: args{ c: &config.Config{ Dir: "{{.InterfaceDir}}/{{.PackagePath}}", - FileName: "{{.InterfaceName}}_{{.InterfaceNameCamel}}_{{.InterfaceNameSnake}}_{{.InterfaceNameLower}}.go", + FileName: "{{.InterfaceName}}_{{.InterfaceNameCamel}}_{{.InterfaceNameSnake}}_{{.InterfaceNameLower}}_{{base .InterfaceFile}}", MockName: "{{.InterfaceNameLowerCamel}}", Outpkg: "{{.PackageName}}", }, @@ -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_foobar.go", + FileName: "FooBar_FooBar_foo_bar_foobar_foobar.go", MockName: "fooBar", Outpkg: "packageName", },