Commit 33dcf91 1 parent 5e9ce17 commit 33dcf91 Copy full SHA for 33dcf91
File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,18 @@ import (
22
22
"testing"
23
23
)
24
24
25
+ func TestCapitalize (t * testing.T ) {
26
+ if ret := Capitalize ("" ); ret != "" {
27
+ t .Fatal ("Capitalize:" , ret )
28
+ }
29
+ if ret := Capitalize ("hello" ); ret != "Hello" {
30
+ t .Fatal ("Capitalize:" , ret )
31
+ }
32
+ if ret := Capitalize ("Hello" ); ret != "Hello" {
33
+ t .Fatal ("Capitalize:" , ret )
34
+ }
35
+ }
36
+
25
37
func TestConcat (t * testing.T ) {
26
38
if ret := Concat ("1" ); ret != "1" {
27
39
t .Fatal ("Concat(1):" , ret )
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ import (
25
25
// its upper case.
26
26
func Capitalize (str string ) string {
27
27
c , nc := utf8 .DecodeRuneInString (str )
28
- if c == utf8 .RuneError || unicode . IsUpper ( c ) {
28
+ if unicode . IsUpper ( c ) || c == utf8 .RuneError {
29
29
return str
30
30
}
31
31
ret := make ([]byte , len (str ))
You can’t perform that action at this time.
0 commit comments