(t *testing.T)
| 451 | } |
| 452 | |
| 453 | func TestOffsetToLineColumn(t *testing.T) { |
| 454 | content := "SELECT *\nFROM users\nWHERE id = 1" |
| 455 | |
| 456 | tests := []struct { |
| 457 | offset int |
| 458 | expectedLine int |
| 459 | expectedCol int |
| 460 | }{ |
| 461 | {0, 0, 0}, // Start of file |
| 462 | {6, 0, 6}, // "SELECT" -> 'T' |
| 463 | {9, 1, 0}, // After "SELECT *\n" -> start of line 1 |
| 464 | {14, 1, 5}, // "FROM " -> space after FROM |
| 465 | {20, 2, 0}, // Start of line 2 (WHERE) |
| 466 | {100, 2, 11}, // Beyond end -> clamped to last char (content length is 32, so index 31 = col 11) |
| 467 | } |
| 468 | |
| 469 | for _, tt := range tests { |
| 470 | line, col := offsetToLineColumn(content, tt.offset) |
| 471 | if line != tt.expectedLine || col != tt.expectedCol { |
| 472 | t.Errorf("offsetToLineColumn(%d) = (%d, %d), want (%d, %d)", |
| 473 | tt.offset, line, col, tt.expectedLine, tt.expectedCol) |
| 474 | } |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | func TestSnippetCompletions(t *testing.T) { |
| 479 | mock := newMockReadWriter() |
nothing calls this directly
no test coverage detected