MCPcopy Create free account
hub / github.com/tendermint/tendermint / TestSplitAndTrimEmpty

Function TestSplitAndTrimEmpty

libs/strings/string_test.go:9–26  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestSplitAndTrimEmpty(t *testing.T) {
10 testCases := []struct {
11 s string
12 sep string
13 cutset string
14 expected []string
15 }{
16 {"a,b,c", ",", " ", []string{"a", "b", "c"}},
17 {" a , b , c ", ",", " ", []string{"a", "b", "c"}},
18 {" a, b, c ", ",", " ", []string{"a", "b", "c"}},
19 {" a, ", ",", " ", []string{"a"}},
20 {" ", ",", " ", []string{}},
21 }
22
23 for _, tc := range testCases {
24 require.Equal(t, tc.expected, SplitAndTrimEmpty(tc.s, tc.sep, tc.cutset), "%s", tc.s)
25 }
26}
27
28func TestStringInSlice(t *testing.T) {
29 require.True(t, StringInSlice("a", []string{"a", "b", "c"}))

Callers

nothing calls this directly

Calls 2

SplitAndTrimEmptyFunction · 0.85
EqualMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…