go-chart/stringutil_test.go
Zeni Kim cc8d36edd9
Some checks failed
Continuous Integration / Tests (push) Has been cancelled
update url
2024-10-27 21:52:38 -05:00

22 lines
946 B
Go

package chart
import (
"testing"
"git.smarteching.com/zeni/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\"'"))
}