go-chart/stringutil_test.go

23 lines
946 B
Go
Raw Normal View History

2019-02-13 19:09:26 -05:00
package chart
import (
"testing"
2024-10-27 22:52:38 -04:00
"git.smarteching.com/zeni/go-chart/v2/testutil"
2019-02-13 19:09:26 -05:00
)
func TestSplitCSV(t *testing.T) {
// replaced new assertions helper
2019-02-13 19:09:26 -05:00
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\"'"))
2019-02-13 19:09:26 -05:00
}