diff --git a/helper_test.go b/helper_test.go new file mode 100644 index 0000000..7f5dcca --- /dev/null +++ b/helper_test.go @@ -0,0 +1,7 @@ +package csv + +func must(err error) { + if err != nil { + panic(err) + } +} diff --git a/writer_samber_test.go b/writer_samber_test.go index 3ec545e..2b93413 100644 --- a/writer_samber_test.go +++ b/writer_samber_test.go @@ -7,12 +7,6 @@ import ( "github.com/stretchr/testify/assert" ) -func must(err error) { - if err != nil { - panic(err) - } -} - func buildTest(forceDoubleQuotes bool, escapeCharEqual bool, escapeCharPlus bool, escapeCharMinus bool, escapeCharAt bool, escapeCharTab bool, escapeCharCR bool) string { var buff strings.Builder diff --git a/writer_stdlib_test.go b/writer_stdlib_test.go index 8e68a1d..a7f7d9f 100644 --- a/writer_stdlib_test.go +++ b/writer_stdlib_test.go @@ -73,7 +73,7 @@ func (e errorWriter) Write(b []byte) (int, error) { func TestError(t *testing.T) { b := &bytes.Buffer{} f := NewSafeWriter(b, SafetyOpts{}) - f.Write([]string{"abc"}) + must(f.Write([]string{"abc"})) f.Flush() err := f.Error() @@ -82,7 +82,7 @@ func TestError(t *testing.T) { } f = NewSafeWriter(errorWriter{}, SafetyOpts{}) - f.Write([]string{"abc"}) + must(f.Write([]string{"abc"})) f.Flush() err = f.Error()