...

Source file src/github.com/gobuffalo/flect/titleize_test.go

Documentation: github.com/gobuffalo/flect

     1  package flect
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  )
     8  
     9  func Test_Titleize(t *testing.T) {
    10  	table := []tt{
    11  		{"", ""},
    12  		{"bob dylan", "Bob Dylan"},
    13  		{"Nice to see you!", "Nice To See You!"},
    14  		{"*hello*", "*hello*"},
    15  		{"hello *wonderful* world!", "Hello *wonderful* World!"}, // CHKME
    16  		{"i've read a book! have you?", "I've Read A Book! Have You?"},
    17  		{"This is `code` ok", "This Is `code` OK"},
    18  		{"foo_bar", "Foo Bar"},
    19  		{"admin/widget", "Admin Widget"},
    20  		{"widget", "Widget"},
    21  		{"óbito", "Óbito"},
    22  	}
    23  
    24  	for _, tt := range table {
    25  		t.Run(tt.act, func(st *testing.T) {
    26  			r := require.New(st)
    27  			r.Equal(tt.exp, Titleize(tt.act))
    28  			r.Equal(tt.exp, Titleize(tt.exp))
    29  		})
    30  	}
    31  }
    32  

View as plain text