-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstringUp_test.go
55 lines (49 loc) · 1.65 KB
/
stringUp_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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package stringUp
import (
"testing"
)
func TestCamelCased(t *testing.T) {
const cameled,upCameled = "thisIsIt", "ThisIsItBob"
if x := CamelCase(cameled); x != cameled {
t.Errorf("CamelCase(%v) = %v, want %v", cameled, x, cameled)
}
if x := CamelCase(upCameled); x != upCameled {
t.Errorf("CamelCase(%v) = %v, want %v", upCameled, x, upCameled)
}
}
func TestCamelCaseSpaced(t *testing.T) {
const src,upSrc = "this is it", "This Is It Bob"
if x := CamelCase(src); x != "thisIsIt" {
t.Errorf("CamelCase(%v) = %v, want %v", src, x, "thisIsIt")
}
if x := CamelCase(upSrc); x != "ThisIsItBob" {
t.Errorf("CamelCase(%v) = %v, want %v", upSrc, x, "ThisIsItBob")
}
}
func TestCamelCaseUnderscored(t *testing.T) {
const src,upSrc = "this_is_it", "This_Is_It_Bob"
if x := CamelCase(src); x != "thisIsIt" {
t.Errorf("CamelCase(%v) = %v, want %v", src, x, "thisIsIt")
}
if x := CamelCase(upSrc); x != "ThisIsItBob" {
t.Errorf("CamelCase(%v) = %v, want %v", upSrc, x, "ThisIsItBob")
}
}
func TestCamelCaseDashed(t *testing.T) {
const src,upSrc = "this-is-it", "This-Is-It-Bob"
if x := CamelCase(src); x != "thisIsIt" {
t.Errorf("CamelCase(%v) = %v, want %v", src, x, "thisIsIt")
}
if x := CamelCase(upSrc); x != "ThisIsItBob" {
t.Errorf("CamelCase(%v) = %v, want %v", upSrc, x, "ThisIsItBob")
}
}
func TestCamelCaseMixed(t *testing.T) {
const src,upSrc = "-this is_it", "This Is_It-Bob"
if x := CamelCase(src); x != "thisIsIt" {
t.Errorf("CamelCase(%v) = %v, want %v", src, x, "thisIsIt")
}
if x := CamelCase(upSrc); x != "ThisIsItBob" {
t.Errorf("CamelCase(%v) = %v, want %v", upSrc, x, "ThisIsItBob")
}
}