2019-02-13 19:09:26 -05:00
|
|
|
package chart
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2020-11-22 19:45:10 -05:00
|
|
|
"github.com/wcharczuk/go-chart/v2/testutil"
|
2019-02-13 19:09:26 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestSplitCSV(t *testing.T) {
|
2020-11-22 19:45:10 -05:00
|
|
|
// replaced new assertions helper
|
2019-02-13 19:09:26 -05:00
|
|
|
|
2020-11-22 19:45:10 -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
|
|
|
}
|