24 lines
473 B
Go
24 lines
473 B
Go
package modelrepo
|
|
|
|
import "testing"
|
|
|
|
func TestIsFieldEmpty(t *testing.T) {
|
|
tests := []struct {
|
|
give any
|
|
want bool
|
|
}{
|
|
{give: nil, want: true},
|
|
{give: "", want: true},
|
|
{give: 0, want: true},
|
|
{give: []string{}, want: true},
|
|
{give: map[string]string{}, want: true},
|
|
{give: []int{}, want: true},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
if got := isFieldEmpty(tt.give); got != tt.want {
|
|
t.Errorf("IsFieldEmpty(%v) = %v, want = %v", tt.give, got, tt.want)
|
|
}
|
|
}
|
|
}
|