(t *testing.T)
| 198 | } |
| 199 | |
| 200 | func TestQualifiedIdentifierPosition(t *testing.T) { |
| 201 | tree := parseWithPositions(t, "SELECT u.id FROM users u") |
| 202 | |
| 203 | sel := tree.Statements[0].(*ast.SelectStatement) |
| 204 | |
| 205 | if len(sel.Columns) == 0 { |
| 206 | t.Fatal("expected at least 1 column") |
| 207 | } |
| 208 | |
| 209 | ident, ok := sel.Columns[0].(*ast.Identifier) |
| 210 | if !ok { |
| 211 | t.Fatalf("expected *ast.Identifier, got %T", sel.Columns[0]) |
| 212 | } |
| 213 | |
| 214 | // Qualified identifier should have position of the table qualifier |
| 215 | assertPos(t, "Identifier(u.id).Pos", ident.Pos) |
| 216 | if ident.Name != "id" || ident.Table != "u" { |
| 217 | t.Errorf("expected u.id, got %s.%s", ident.Table, ident.Name) |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | // ----------------------------------------------------------------------------- |
| 222 | // TestFunctionCallPosition verifies FunctionCall nodes carry positions |
nothing calls this directly
no test coverage detected