...

Source file src/github.com/gobuffalo/flect/name/file_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_File(t *testing.T) {
    10  	table := []tt{
    11  		{"", ""},
    12  		{"foo_bar", "foo_bar"},
    13  		{"admin/widget", "admin/widget"},
    14  		{"admin/widgets", "admin/widgets"},
    15  		{"widget", "widget"},
    16  		{"widgets", "widgets"},
    17  		{"User", "user"},
    18  		{"U$er", "u_er"},
    19  	}
    20  
    21  	for _, tt := range table {
    22  		t.Run(tt.act, func(st *testing.T) {
    23  			r := require.New(st)
    24  			r.Equal(tt.exp, File(tt.act))
    25  			r.Equal(tt.exp, File(tt.exp))
    26  			r.Equal(tt.exp+".a.b", File(tt.act, ".a", ".b"))
    27  		})
    28  	}
    29  }
    30  

View as plain text