Skip to content

Commit

Permalink
test: add cases
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfogre committed May 6, 2020
1 parent 971ae48 commit e6fe1b4
Show file tree
Hide file tree
Showing 2 changed files with 172 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/internal/regular/empty_tag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,43 @@ func TestEmpty_Tags(t *testing.T) {
})
}
}

func TestEmpty_TagsJson(t *testing.T) {
tests := []struct {
name string
want EmptyTags
}{
{
name: "regular",
want: EmptyTags{},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := Empty{}
if got := v.TagsJson(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("TagsJson() = %v, want %v", got, tt.want)
}
})
}
}

func TestEmpty_TagsBson(t *testing.T) {
tests := []struct {
name string
want EmptyTags
}{
{
name: "regular",
want: EmptyTags{},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := Empty{}
if got := v.TagsBson(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("TagsBson() = %v, want %v", got, tt.want)
}
})
}
}
132 changes: 132 additions & 0 deletions test/internal/regular/user_tag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,135 @@ func TestUserName_Tags(t *testing.T) {
})
}
}

func TestUserName_TagsJson(t *testing.T) {
type fields struct {
First string
Last string
}
tests := []struct {
name string
fields fields
want UserNameTags
}{
{
name: "regular",
fields: fields{},
want: UserNameTags{
First: "first",
Last: "last",
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := UserName{
First: tt.fields.First,
Last: tt.fields.Last,
}
if got := v.TagsJson(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("TagsJson() = %v, want %v", got, tt.want)
}
})
}
}

func TestUserName_TagsBson(t *testing.T) {
type fields struct {
First string
Last string
}
tests := []struct {
name string
fields fields
want UserNameTags
}{
{
name: "regular",
fields: fields{},
want: UserNameTags{},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := UserName{
First: tt.fields.First,
Last: tt.fields.Last,
}
if got := v.TagsBson(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("TagsBson() = %v, want %v", got, tt.want)
}
})
}
}

func TestUser_TagsJson(t *testing.T) {
type fields struct {
Id int
Name UserName
Email string
age int
}
tests := []struct {
name string
fields fields
want UserTags
}{
{
name: "regular",
fields: fields{},
want: UserTags{
Id: "id",
Name: "name",
Email: "email",
age: "",
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := User{
Id: tt.fields.Id,
Name: tt.fields.Name,
Email: tt.fields.Email,
age: tt.fields.age,
}
if got := v.TagsJson(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("TagsJson() = %v, want %v", got, tt.want)
}
})
}
}

func TestUser_TagsBson(t *testing.T) {
type fields struct {
Id int
Name UserName
Email string
age int
}
tests := []struct {
name string
fields fields
want UserTags
}{
{
name: "regular",
fields: fields{},
want: UserTags{},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := User{
Id: tt.fields.Id,
Name: tt.fields.Name,
Email: tt.fields.Email,
age: tt.fields.age,
}
if got := v.TagsBson(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("TagsBson() = %v, want %v", got, tt.want)
}
})
}
}

0 comments on commit e6fe1b4

Please sign in to comment.