(t *testing.T)
| 383 | } |
| 384 | |
| 385 | func 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 | |
| 411 | func TestAddDRToBuffer(t *testing.T) { |
| 412 | b := createNewBuffer() |
nothing calls this directly
no test coverage detected