github.com/songzhibin97/gkit@v1.2.13/sys/stringx/is_test.go (about)

     1  package stringx
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestIs(t *testing.T) {
    10  	is := assert.New(t)
    11  
    12  	is.False(IsNumeric(""))
    13  	is.False(IsNumeric("  "))
    14  	is.False(IsNumeric(" bob "))
    15  	is.True(IsNumeric("123"))
    16  
    17  	is.False(IsAlpha(""))
    18  	is.False(IsAlpha(" "))
    19  	is.False(IsAlpha(" Voa "))
    20  	is.False(IsAlpha("123"))
    21  	is.True(IsAlpha("Voa"))
    22  	is.True(IsAlpha("bròwn"))
    23  
    24  	is.False(IsAlphanumeric(""))
    25  	is.False(IsAlphanumeric(" "))
    26  	is.False(IsAlphanumeric(" Voa "))
    27  	is.True(IsAlphanumeric("Voa"))
    28  	is.True(IsAlphanumeric("123"))
    29  	is.True(IsAlphanumeric("v123oa"))
    30  	is.False(IsAlphanumeric("v123oa,"))
    31  }