1 parent
d622e74c51
commit
a2cc32c908
4 files changed
+77
-11
No files matched your search
@@ -91,6 +91,30 @@ func TestRuneSliceWidthRange(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSplitWord(t *testing.T) {
|
||||
strs := []struct {
|
||||
s string
|
||||
word string
|
||||
rest string
|
||||
}{
|
||||
{"", "", ""},
|
||||
{"foo", "foo", ""},
|
||||
{" foo", "foo", ""},
|
||||
{"foo ", "foo", ""},
|
||||
{" foo ", "foo", ""},
|
||||
{"foo bar baz", "foo", "bar baz"},
|
||||
{" foo bar baz", "foo", "bar baz"},
|
||||
{"foo bar baz", "foo", "bar baz"},
|
||||
{" foo bar baz", "foo", "bar baz"},
|
||||
}
|
||||
|
||||
for _, str := range strs {
|
||||
if w, r := splitWord(str.s); w != str.word || r != str.rest {
|
||||
t.Errorf("at input '%s' expected '%s' and '%s' but got '%s' and '%s'", str.s, str.word, str.rest, w, r)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestHumanize(t *testing.T) {
|
||||
nums := []struct {
|
||||
i int64
|
||||
|
||||
Reference in new issue
Block a user