-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsfmt_test.go
28 lines (24 loc) · 1010 Bytes
/
sfmt_test.go
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
package sfmt
import (
"reflect"
"testing"
)
func testSliceEqual(t *testing.T, output []string, expected []string) {
if !reflect.DeepEqual(output, expected) {
t.Errorf("found: %s\n expected: %s", output, expected)
}
}
func TestFormatRecognition(t *testing.T) {
testSliceEqual(t, getElements("from spaced format"), []string{"from", "spaced", "format"})
testSliceEqual(t, getElements("from.doted.format"), []string{"from", "doted", "format"})
testSliceEqual(t, getElements("from-dashed-format"), []string{"from", "dashed", "format"})
testSliceEqual(t, getElements("from_underscored_format"), []string{"from", "underscored", "format"})
testSliceEqual(t, getElements("fromUnderscoredFormat"), []string{"from", "underscored", "format"})
testSliceEqual(t, getElements("FromUnderscoredFormat"), []string{"from", "underscored", "format"})
}
func TestLowerSlice(t *testing.T) {
testSliceEqual(
t,
lowerSlice([]string{"Some", "Uppercase", "Items"}),
[]string{"some", "uppercase", "items"})
}