github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/depends/util/strfmt/zz_test.go (about)

     1  package strfmt_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/onsi/gomega"
     7  
     8  	"github.com/machinefi/w3bstream/pkg/depends/util/strfmt"
     9  )
    10  
    11  func TestProjectNameValidator(t *testing.T) {
    12  	var cases = []*struct {
    13  		name  string
    14  		input string
    15  		succ  bool
    16  	}{
    17  		{"InvalidChar", "@xadfef", false},
    18  		{"UpperChar", "Xadfef", false},
    19  		{"Succ1", "123123", true},
    20  		{"Succ2", "abcedf", true},
    21  		{"Succ3", "abc_123", true},
    22  	}
    23  
    24  	vldt := strfmt.ProjectNameValidator
    25  
    26  	for _, c := range cases {
    27  		t.Run(c.name, func(t *testing.T) {
    28  			if c.succ {
    29  				NewWithT(t).Expect(vldt.Validate(c.input)).To(BeNil())
    30  			} else {
    31  				NewWithT(t).Expect(vldt.Validate(c.input)).NotTo(BeNil())
    32  			}
    33  		})
    34  	}
    35  }