mirror of
https://github.com/warmbly/warmbly.git
synced 2026-11-17 08:18:51 +00:00
21 lines
636 B
Go
21 lines
636 B
Go
package spreadsheet
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestDelimitedImportRetainsItsFieldAndQuoteProfile(t *testing.T) {
|
|
for _, filename := range []string{"contacts.csv", "contacts.tsv", "contacts.txt"} {
|
|
sep := ","
|
|
if strings.HasSuffix(filename, ".tsv") {
|
|
sep = "\t"
|
|
}
|
|
body := strings.Repeat("x"+sep, 4096) + "bare\"quote\r\nshort\r\n"
|
|
rows, kind, err := Parse(strings.NewReader(body), filename, 0)
|
|
if err != nil || kind != "csv" || len(rows) != 2 || len(rows[0]) != 4097 || rows[0][4096] != "bare\"quote" || len(rows[1]) != 1 {
|
|
t.Fatalf("%s: kind=%s rows=%d error=%v", filename, kind, len(rows), err)
|
|
}
|
|
}
|
|
}
|