...
1 package flect
2
3 import (
4 "testing"
5
6 "github.com/stretchr/testify/require"
7 )
8
9 func Test_Capitalize(t *testing.T) {
10 table := []tt{
11 {"", ""},
12 {"foo", "Foo"},
13 {"bob dylan", "Bob dylan"},
14 {"WidgetID", "WidgetID"},
15 {"widget_id", "Widget_id"},
16 {"widget_ID", "Widget_ID"},
17 {"widget ID", "Widget ID"},
18 {"гофер", "Гофер"},
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, Capitalize(tt.act))
25 r.Equal(tt.exp, Capitalize(tt.exp))
26 })
27 }
28 }
29
View as plain text