----------------------------------------------------------------------------- TestFunctionCallPosition verifies FunctionCall nodes carry positions -----------------------------------------------------------------------------
(t *testing.T)
| 223 | // ----------------------------------------------------------------------------- |
| 224 | |
| 225 | func TestFunctionCallPosition(t *testing.T) { |
| 226 | tree := parseWithPositions(t, "SELECT COUNT(*) FROM users") |
| 227 | |
| 228 | sel := tree.Statements[0].(*ast.SelectStatement) |
| 229 | |
| 230 | if len(sel.Columns) == 0 { |
| 231 | t.Fatal("expected at least 1 column") |
| 232 | } |
| 233 | |
| 234 | fn, ok := sel.Columns[0].(*ast.FunctionCall) |
| 235 | if !ok { |
| 236 | t.Fatalf("expected *ast.FunctionCall, got %T", sel.Columns[0]) |
| 237 | } |
| 238 | |
| 239 | assertPos(t, "FunctionCall(COUNT).Pos", fn.Pos) |
| 240 | // COUNT starts at column 8 in "SELECT COUNT(*) FROM users" |
| 241 | assertPosEqual(t, "FunctionCall(COUNT).Pos", fn.Pos, 1, 8) |
| 242 | } |
| 243 | |
| 244 | func TestNestedFunctionCallPosition(t *testing.T) { |
| 245 | tree := parseWithPositions(t, "SELECT SUM(amount) FROM orders") |
nothing calls this directly
no test coverage detected