protoc-gen-go-micro/vendor/github.com/huandu/xstrings/util_test.go

34 lines
619 B
Go
Raw Normal View History

2016-12-20 13:31:46 +03:00
// Copyright 2015 Huan Du. All rights reserved.
// Licensed under the MIT license that can be found in the LICENSE file.
package xstrings
import (
"strings"
"testing"
)
type _M map[string]string
const (
separator = " ¶ "
)
func runTestCases(t *testing.T, converter func(string) string, cases map[string]string) {
for k, v := range cases {
s := converter(k)
if s != v {
t.Fatalf("case fails. [case:%v]\nshould => %#v\nactual => %#v", k, v, s)
}
}
}
func sep(strs ...string) string {
return strings.Join(strs, separator)
}
func split(str string) []string {
return strings.Split(str, separator)
}