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.

52 lines
1.0 KiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

package str
import "testing"
func TestIsBlank(t *testing.T) {
var tests = []struct {
param string
expected bool
}{
{"", true},
{" \t\n\r\v\f\x00 ", true},
{"0", false},
{"hello", false},
}
for _, test := range tests {
actual := StrTool.IsBlank(test.param)
if actual != test.expected {
t.Errorf("%s must be %t", test.param, test.expected)
}
}
}
func FuzzStrIsBlank(f *testing.F) {
f.Fuzz(func(t *testing.T, str string) {
StrTool.IsBlank(str)
})
}
func FuzzStrIsNotBlank(f *testing.F) {
f.Fuzz(func(t *testing.T, str string) {
StrTool.IsNotBlank(str)
})
}
func FuzzStr_IsEmpty(f *testing.F) {
f.Fuzz(func(t *testing.T, str string) {
StrTool.IsEmpty(str)
})
}
func FuzzStr_IsNotEmpty(f *testing.F) {
f.Fuzz(func(t *testing.T, str string) {
StrTool.IsNotEmpty(str)
})
}
func FuzzIsBlankOrEmpty(f *testing.F) {
f.Fuzz(func(t *testing.T, str string) {
StrTool.IsBlankOrEmpty(str)
})
}
func FuzzIsNotBlankOrEmpty(f *testing.F) {
f.Fuzz(func(t *testing.T, str string) {
StrTool.IsNotBlankOrEmpty(str)
})
}