validators_test.go 698 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package utl
  2. import (
  3. "testing"
  4. )
  5. func TestIsPhone(t *testing.T) {
  6. phones := []string{
  7. "137234510452",
  8. "12398765434",
  9. "13604550543",
  10. "13456786543",
  11. "16703440355",
  12. "19100001111",
  13. "19200001111",
  14. }
  15. var b, bs bool
  16. var phone string
  17. phone = phones[0]
  18. bs, b = IsPhoneSimple(phone), IsPhone(phone)
  19. AssertFalse(bs, phone + " should not be phone", t)
  20. AssertFalse(b, phone + " should not be phone", t)
  21. phone = phones[1]
  22. bs, b = IsPhoneSimple(phone), IsPhone(phone)
  23. AssertTrue(bs, phone + " should be phone", t)
  24. AssertFalse(b, phone + " should not be phone", t)
  25. }
  26. func TestIsEmail(t *testing.T) {
  27. }
  28. func TestIsAlpha(t *testing.T) {
  29. }
  30. func TestIsSafePasswd(t *testing.T) {
  31. }