github.com/sotirispl/buffalo@v0.11.1/generators/newapp/new_test.go (about)

     1  package newapp
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  )
     8  
     9  func Test_nameHasIllegalCharacter(t *testing.T) {
    10  	m := map[string]bool{
    11  		"coke":                      false,
    12  		"my-coke":                   false,
    13  		"my_coke":                   false,
    14  		"COKE":                      false,
    15  		"MY-COKE":                   false,
    16  		"MY_COKE":                   false,
    17  		"123COKE":                   false,
    18  		"1(3c&ke":                   true,
    19  		"github.com/markbates/coke": true,
    20  	}
    21  	for k, v := range m {
    22  		g, _ := New(k)
    23  		t.Run(k, func(st *testing.T) {
    24  			r := require.New(st)
    25  			if v {
    26  				r.Error(g.Validate())
    27  			} else {
    28  				r.NoError(g.Validate())
    29  			}
    30  		})
    31  	}
    32  }