(t *testing.T)
| 88 | } |
| 89 | |
| 90 | func TestSelectStatementPositionMultiLine(t *testing.T) { |
| 91 | // Two statements on separate lines: verify positions differ |
| 92 | sql := "SELECT 1;\nSELECT 2" |
| 93 | tree := parseWithPositions(t, sql) |
| 94 | |
| 95 | if len(tree.Statements) != 2 { |
| 96 | t.Fatalf("expected 2 statements, got %d", len(tree.Statements)) |
| 97 | } |
| 98 | |
| 99 | sel1, ok := tree.Statements[0].(*ast.SelectStatement) |
| 100 | if !ok { |
| 101 | t.Fatalf("expected *ast.SelectStatement for stmt 1, got %T", tree.Statements[0]) |
| 102 | } |
| 103 | sel2, ok := tree.Statements[1].(*ast.SelectStatement) |
| 104 | if !ok { |
| 105 | t.Fatalf("expected *ast.SelectStatement for stmt 2, got %T", tree.Statements[1]) |
| 106 | } |
| 107 | |
| 108 | // Both must have non-zero positions |
| 109 | assertPos(t, "SELECT1.Pos", sel1.Pos) |
| 110 | assertPos(t, "SELECT2.Pos", sel2.Pos) |
| 111 | |
| 112 | // The second SELECT should be on a later line than the first |
| 113 | if sel2.Pos.Line <= sel1.Pos.Line { |
| 114 | t.Errorf("second SELECT.Pos.Line (%d) should be > first (%d)", |
| 115 | sel2.Pos.Line, sel1.Pos.Line) |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | // ----------------------------------------------------------------------------- |
| 120 | // TestInsertStatementPosition verifies INSERT statement position |
nothing calls this directly
no test coverage detected