MCPcopy Create free account
hub / github.com/codechenx/FastTableViewer / TestLineCSVParse

Function TestLineCSVParse

io_test.go:385–409  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

383}
384
385func TestLineCSVParse(t *testing.T) {
386 tests := []struct {
387 name string
388 line string
389 sep rune
390 wantLen int
391 }{
392 {"Simple CSV", "a,b,c", ',', 3},
393 {"Tab separated", "a\tb\tc", '\t', 3},
394 {"Empty fields", "a,,c", ',', 3},
395 {"Single field", "single", ',', 1},
396 }
397
398 for _, tt := range tests {
399 t.Run(tt.name, func(t *testing.T) {
400 result, err := lineCSVParse(tt.line, tt.sep)
401 if err != nil {
402 t.Fatalf("lineCSVParse() error = %v", err)
403 }
404 if len(result) != tt.wantLen {
405 t.Errorf("lineCSVParse() returned %d fields, want %d", len(result), tt.wantLen)
406 }
407 })
408 }
409}
410
411func TestAddDRToBuffer(t *testing.T) {
412 b := createNewBuffer()

Callers

nothing calls this directly

Calls 1

lineCSVParseFunction · 0.85

Tested by

no test coverage detected