MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestSelectStatementPosition

Function TestSelectStatementPosition

pkg/sql/ast/positions_test.go:75–88  ·  view source on GitHub ↗

----------------------------------------------------------------------------- TestSelectStatementPosition verifies SELECT statement position -----------------------------------------------------------------------------

(t *testing.T)

Source from the content-addressed store, hash-verified

73// -----------------------------------------------------------------------------
74
75func TestSelectStatementPosition(t *testing.T) {
76 tree := parseWithPositions(t, "SELECT id, name FROM users")
77
78 if len(tree.Statements) != 1 {
79 t.Fatalf("expected 1 statement, got %d", len(tree.Statements))
80 }
81
82 sel, ok := tree.Statements[0].(*ast.SelectStatement)
83 if !ok {
84 t.Fatalf("expected *ast.SelectStatement, got %T", tree.Statements[0])
85 }
86
87 assertPosEqual(t, "SELECT.Pos", sel.Pos, 1, 1)
88}
89
90func TestSelectStatementPositionMultiLine(t *testing.T) {
91 // Two statements on separate lines: verify positions differ

Callers

nothing calls this directly

Calls 3

parseWithPositionsFunction · 0.85
assertPosEqualFunction · 0.85
FatalfMethod · 0.65

Tested by

no test coverage detected