-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrings_test.go
More file actions
49 lines (43 loc) · 1.08 KB
/
strings_test.go
File metadata and controls
49 lines (43 loc) · 1.08 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package enumify_test
import (
"testing"
"github.com/stretchr/testify/require"
"go.rtnl.ai/enumify"
)
func TestLowerFirst(t *testing.T) {
tests := []struct {
input string
expected string
}{
{input: "", expected: ""},
{input: "foo", expected: "foo"},
{input: "Foo", expected: "foo"},
{input: "FOO", expected: "fOO"},
{input: "FooBar", expected: "fooBar"},
{input: "ΩTime", expected: "ωTime"},
{input: "ωTime", expected: "ωTime"},
}
for _, test := range tests {
actual := enumify.LowerFirst(test.input)
require.Equal(t, test.expected, actual)
}
}
func TestUpperFirst(t *testing.T) {
tests := []struct {
input string
expected string
}{
{input: "", expected: ""},
{input: "foo", expected: "Foo"},
{input: "Foo", expected: "Foo"},
{input: "FOO", expected: "FOO"},
{input: "FooBar", expected: "FooBar"},
{input: "fooBar", expected: "FooBar"},
{input: "ΩTime", expected: "ΩTime"},
{input: "ωTime", expected: "ΩTime"},
}
for _, test := range tests {
actual := enumify.UpperFirst(test.input)
require.Equal(t, test.expected, actual)
}
}