You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
FLEcli/cmd/fle_date_test.go

39 lines
830 B

package cmd
import "testing"
func TestValidateDate(t *testing.T) {
type args struct {
inputStr string
}
tests := []struct {
name string
args args
wantRef string
wantErrorMsg string
}{
{
"Good date (simple)",
args{ inputStr: "2020-06-10", },
"2020-06-10", "",
},
{
"Bad date (simple)",
args{ inputStr: "2020-13-10", },
"*2020-13-10", "parsing time \"2020-13-10\": month out of range",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
gotRef, gotErrorMsg := ValidateDate(tt.args.inputStr)
if gotRef != tt.wantRef {
t.Errorf("ValidateDate() gotRef = %v, want %v", gotRef, tt.wantRef)
}
if gotErrorMsg != tt.wantErrorMsg {
t.Errorf("ValidateDate() gotErrorMsg = %v, want %v", gotErrorMsg, tt.wantErrorMsg)
}
})
}
}