Skip to content

Commit

Permalink
TEST/MINOR: compare: changing generation to accomodate interface{}
Browse files Browse the repository at this point in the history
  • Loading branch information
mjuraga committed Sep 19, 2024
1 parent 788069d commit 2bc7574
Show file tree
Hide file tree
Showing 136 changed files with 1,151 additions and 1,007 deletions.
10 changes: 10 additions & 0 deletions cmd/struct_equal_generator/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ func generateEqualAndDiff(opt generateEqualAndDiffOptions) error {
}

func generateCompareTests(opt generateEqualAndDiffOptions) error {
var metadataIndex int
for i, f := range opt.Fields {
if f.Name == "Metadata" {
metadataIndex = i
break
}
}
if metadataIndex > 0 {
opt.Fields = append(opt.Fields[:metadataIndex], opt.Fields[metadataIndex+1:]...)
}
if opt.Mode == "array" {
return nil
}
Expand Down
1 change: 1 addition & 0 deletions cmd/struct_equal_generator/header.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"encoding/gob"

"github.com/go-faker/faker/v4"
"github.com/go-faker/faker/v4/pkg/options"
"github.com/go-openapi/strfmt"

jsoniter "github.com/json-iterator/go"
Expand Down
6 changes: 3 additions & 3 deletions cmd/struct_equal_generator/test.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ func Test{{$.Name}}{{.}}(t *testing.T) {
for i := 0; i < 2; i++ {
var sample {{$.Name}}
var result {{$.Name}}
err := faker.FakeData(&sample)
err := faker.FakeData(&sample, options.WithIgnoreInterface(true))
if err != nil {
t.Errorf(err.Error())
}
Expand Down Expand Up @@ -62,11 +62,11 @@ func Test{{$.Name}}{{.}}False(t *testing.T) {
for i := 0; i < 2; i++ {
var sample {{$.Name}}
var result {{$.Name}}
err := faker.FakeData(&sample)
err := faker.FakeData(&sample, options.WithIgnoreInterface(true))
if err != nil {
t.Errorf(err.Error())
}
err = faker.FakeData(&result)
err = faker.FakeData(&result, options.WithIgnoreInterface(true))
if err != nil {
t.Errorf(err.Error())
}
Expand Down
13 changes: 7 additions & 6 deletions models/acl_compare_test.go

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

13 changes: 7 additions & 6 deletions models/acl_file_compare_test.go

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

13 changes: 7 additions & 6 deletions models/acl_file_entry_compare_test.go

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

13 changes: 7 additions & 6 deletions models/aws_filters_compare_test.go

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

13 changes: 7 additions & 6 deletions models/aws_region_compare_test.go

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

Loading

0 comments on commit 2bc7574

Please sign in to comment.