...
1 package flect
2
3 import (
4 "testing"
5
6 "github.com/stretchr/testify/require"
7 )
8
9 func Test_Humanize(t *testing.T) {
10 table := []tt{
11 {"", ""},
12 {"id", "ID"},
13 {"url", "URL"},
14 {"IBM", "IBM"},
15 {"CAUTION! CAPs are CAPs!", "CAUTION! CAPs are CAPs!"},
16 {"employee_mobile_number", "Employee mobile number"},
17 {"employee_salary", "Employee salary"},
18 {"employee_id", "Employee ID"},
19 {"employee_ID", "Employee ID"},
20 {"first_name", "First name"},
21 {"first_Name", "First Name"},
22 {"firstName", "First Name"},
23 {"óbito", "Óbito"},
24 }
25
26 for _, tt := range table {
27 t.Run(tt.act, func(st *testing.T) {
28 r := require.New(st)
29 r.Equal(tt.exp, Humanize(tt.act))
30 r.Equal(tt.exp, Humanize(tt.exp))
31 })
32 }
33 }
34
View as plain text