Skip to content

Commit

Permalink
test: add package name tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jmattheis committed Oct 22, 2023
1 parent 3e2054b commit 02694e5
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
39 changes: 39 additions & 0 deletions scenario/into_source_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
input:
input.go: |
package structs
// goverter:converter
// goverter:extend StringPToString
// goverter:output ./generated.go
// goverter:outputPackage github.com/jmattheis/goverter/execution:structs
type Converter interface {
ConvertPerson(source Input) Output
}
func StringPToString(value *string) string {
if value == nil {
return ""
}
return *value
}
type Input struct {
Name *string
}
type Output struct {
Name string
}
success:
- generated.go: |
// Code generated by github.com/jmattheis/goverter, DO NOT EDIT.
package structs
type ConverterImpl struct{}
func (c *ConverterImpl) ConvertPerson(source Input) Output {
var structsOutput Output
structsOutput.Name = StringPToString(source.Name)
return structsOutput
}
31 changes: 31 additions & 0 deletions scenario/package_name.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
input:
input.go: |
package pkg
// goverter:converter
// goverter:outputPackage github.com/jmattheis/goverter/execution/generated:myname
type Converter2 interface {
Convert(source Input) Output
}
type Input struct {
ID int
}
type Output struct {
ID int
}
success:
- generated/generated.go: |
// Code generated by github.com/jmattheis/goverter, DO NOT EDIT.
package myname
import execution "github.com/jmattheis/goverter/execution"
type Converter2Impl struct{}
func (c *Converter2Impl) Convert(source execution.Input) execution.Output {
var pkgOutput execution.Output
pkgOutput.ID = source.ID
return pkgOutput
}

0 comments on commit 02694e5

Please sign in to comment.