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