...

Source file src/github.com/gobuffalo/flect/name/char_test.go

Documentation: github.com/gobuffalo/flect/name

     1  package name
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  )
     8  
     9  func Test_Char(t *testing.T) {
    10  	table := []tt{
    11  		{"", "x"},
    12  		{"foo_bar", "f"},
    13  		{"admin/widget", "a"},
    14  		{"123d4545", "d"},
    15  		{"!@#$%^&*", "x"},
    16  	}
    17  
    18  	for _, tt := range table {
    19  		t.Run(tt.act, func(st *testing.T) {
    20  			r := require.New(st)
    21  			r.Equal(tt.exp, Char(tt.act))
    22  			r.Equal(tt.exp, Char(tt.exp))
    23  		})
    24  	}
    25  }
    26  

View as plain text