rts-sim-module/cgrepo/check_test.go

24 lines
468 B
Go
Raw Normal View History

2023-12-27 09:15:26 +08:00
package repo
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)
}
}
}