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

Function TestBinaryExpressionPosition

pkg/sql/ast/positions_test.go:261–275  ·  view source on GitHub ↗

----------------------------------------------------------------------------- TestBinaryExpressionPosition verifies BinaryExpression nodes carry positions -----------------------------------------------------------------------------

(t *testing.T)

Source from the content-addressed store, hash-verified

259// -----------------------------------------------------------------------------
260
261func TestBinaryExpressionPosition(t *testing.T) {
262 tree := parseWithPositions(t, "SELECT * FROM users WHERE id = 1")
263
264 sel := tree.Statements[0].(*ast.SelectStatement)
265 if sel.Where == nil {
266 t.Fatal("expected WHERE clause")
267 }
268
269 binExpr, ok := sel.Where.(*ast.BinaryExpression)
270 if !ok {
271 t.Fatalf("expected *ast.BinaryExpression in WHERE, got %T", sel.Where)
272 }
273
274 assertPos(t, "BinaryExpression(=).Pos", binExpr.Pos)
275}
276
277func TestANDExpressionPosition(t *testing.T) {
278 tree := parseWithPositions(t, "SELECT * FROM users WHERE id = 1 AND active = true")

Callers

nothing calls this directly

Calls 3

parseWithPositionsFunction · 0.85
assertPosFunction · 0.85
FatalfMethod · 0.65

Tested by

no test coverage detected