mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-03 10:32:05 +00:00
27 lines
574 B
Go
27 lines
574 B
Go
package node
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestSplitAndTrimEmpty(t *testing.T) {
|
|
testCases := []struct {
|
|
s string
|
|
sep string
|
|
cutset string
|
|
expected []string
|
|
}{
|
|
{"a,b,c", ",", " ", []string{"a", "b", "c"}},
|
|
{" a , b , c ", ",", " ", []string{"a", "b", "c"}},
|
|
{" a, b, c ", ",", " ", []string{"a", "b", "c"}},
|
|
{" a, ", ",", " ", []string{"a"}},
|
|
{" ", ",", " ", []string{}},
|
|
}
|
|
|
|
for _, tc := range testCases {
|
|
assert.Equal(t, tc.expected, splitAndTrimEmpty(tc.s, tc.sep, tc.cutset), "%s", tc.s)
|
|
}
|
|
}
|