Skip to content

Commit

Permalink
Merge c3bae16 into 21226ce
Browse files Browse the repository at this point in the history
  • Loading branch information
msolimans committed Oct 7, 2018
2 parents 21226ce + c3bae16 commit 18be57f
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 13 deletions.
10 changes: 7 additions & 3 deletions main_test.go
Expand Up @@ -106,13 +106,13 @@ func TestNewTagItems(t *testing.T) {
}

func TestContinueParsingWhenSkippingFields(t *testing.T) {
expectedTags := []string{`valid:"ip" yaml:"ip" json:"overrided"`, `valid:"http|https"`, `valid:"nonzero"`}
expectedTags := []string{`valid:"ip" yaml:"ip" json:"overrided"`, `xml:"-"`, `xml:"-"`, `xml:"-"`, `valid:"http|https"`, `valid:"nonzero"`, `xml:"-"`, `xml:"-"`, `xml:"-"`}

areas, err := parseFile(testInputFile, []string{})
areas, err := parseFile(testInputFile, []string{"xml"})
if err != nil {
t.Fatal(err)
}
if len(areas) != 3 {
if len(areas) != 9 {
t.Fatalf("expected 3 areas to replace, got: %d", len(areas))
}

Expand Down Expand Up @@ -143,9 +143,13 @@ func TestContinueParsingWhenSkippingFields(t *testing.T) {
}

expectedExprs := []string{
"Address string `protobuf:\"bytes,1,opt,name=Address\" json:\"overrided\" valid:\"ip\" yaml:\"ip\"`",
"Address string `protobuf:\"bytes,1,opt,name=Address\" json:\"overrided\" valid:\"ip\" yaml:\"ip\"`",
"Scheme string `protobuf:\"bytes,1,opt,name=scheme\" json:\"scheme,omitempty\" valid:\"http|https\"`",
"Port int32 `protobuf:\"varint,3,opt,name=port\" json:\"port,omitempty\" valid:\"nonzero\"`",
"XXX_NoUnkeyedLiteral struct{} `json:\"-\" xml:\"-\"`",
"XXX_unrecognized []byte `json:\"-\" xml:\"-\"`",
"XXX_sizecache int32 `json:\"-\" xml:\"-\"`",
}

for i, expr := range expectedExprs {
Expand Down
64 changes: 54 additions & 10 deletions pb/test.pb.go

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

0 comments on commit 18be57f

Please sign in to comment.