Skip to content

Commit

Permalink
chore: update unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
paulvollmer committed Jan 27, 2024
1 parent 19b4f49 commit a658929
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions main_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package main

import (
"github.com/stretchr/testify/assert"
"go/ast"
"go/token"
"testing"

"github.com/stretchr/testify/assert"
)

func Test_generate(t *testing.T) {
Expand All @@ -25,12 +26,18 @@ func Test_generate(t *testing.T) {
Type: "int",
},
},
BuildTags: []string{
"//go:build example",
"// +build example",
},
}

result, err := generate(genConfig)
assert.NoError(t, err)

expected := []byte(`// Code generated by go-genbuilder. DO NOT EDIT.
expected := `// Code generated by go-genbuilder. DO NOT EDIT.
//go:build example
// +build example
package testpackage
Expand Down Expand Up @@ -62,9 +69,9 @@ func (builder *TestStructBuilder) SetTestOtherField(testotherfield int) *TestStr
func (builder *TestStructBuilder) Build() *TestStruct {
return builder.teststruct
}
`)
`

assert.Equal(t, expected, result)
assert.Equal(t, expected, string(result))
}

func TestParseFile(t *testing.T) {
Expand Down Expand Up @@ -118,6 +125,10 @@ func TestParseFile(t *testing.T) {
Type: "int",
},
},
BuildTags: []string{
"//go:build example",
"// +build example",
},
}
assert.Equal(t, expected, actual)
})
Expand Down

0 comments on commit a658929

Please sign in to comment.