forked from wcharczuk/go-chart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stringutil_test.go
22 lines (18 loc) · 939 Bytes
/
stringutil_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package chart
import (
"testing"
"github.com/ebudan/go-chart/v2/testutil"
)
func TestSplitCSV(t *testing.T) {
// replaced new assertions helper
testutil.AssertEmpty(t, SplitCSV(""))
testutil.AssertEqual(t, []string{"foo"}, SplitCSV("foo"))
testutil.AssertEqual(t, []string{"foo", "bar"}, SplitCSV("foo,bar"))
testutil.AssertEqual(t, []string{"foo", "bar"}, SplitCSV("foo, bar"))
testutil.AssertEqual(t, []string{"foo", "bar"}, SplitCSV(" foo , bar "))
testutil.AssertEqual(t, []string{"foo", "bar", "baz"}, SplitCSV("foo,bar,baz"))
testutil.AssertEqual(t, []string{"foo", "bar", "baz,buzz"}, SplitCSV("foo,bar,\"baz,buzz\""))
testutil.AssertEqual(t, []string{"foo", "bar", "baz,'buzz'"}, SplitCSV("foo,bar,\"baz,'buzz'\""))
testutil.AssertEqual(t, []string{"foo", "bar", "baz,'buzz"}, SplitCSV("foo,bar,\"baz,'buzz\""))
testutil.AssertEqual(t, []string{"foo", "bar", "baz,\"buzz\""}, SplitCSV("foo,bar,'baz,\"buzz\"'"))
}