cmd_test.go
516 字节
package cmd
import (
"log"
"strings"
"testing"
)
func TestLowFirstCase(t *testing.T){
input :=[]struct{
In string
Out string
}{
{In:"Lower",Out:"lower"},
{In:"First",Out:"first"},
{In:"Test",Out:"test"},
{In:"",Out:""},
{In:"T",Out:"t"},
{In:"Te",Out:"te"},
}
for i:=range input{
result :=LowFirstCase(input[i].In)
if strings.Compare(result,input[i].Out)!=0{
log.Fatal("Result:",result," not equal Out:",input[i].Out)
}else{
log.Println(input[i].In,result,input[i].Out)
}
}
}