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

Function TestStatementImpl

pkg/sql/ast/types_test.go:342–383  ·  view source on GitHub ↗

Test StatementImpl

(t *testing.T)

Source from the content-addressed store, hash-verified

340
341// Test StatementImpl
342func TestStatementImpl(t *testing.T) {
343 tests := []struct {
344 name string
345 stmt *StatementImpl
346 wantLiteral string
347 wantChildren int
348 }{
349 {
350 name: "statement with SELECT variant",
351 stmt: &StatementImpl{
352 Variant: &SelectStatement{
353 Columns: []Expression{
354 &Identifier{Name: "id"},
355 },
356 },
357 },
358 wantLiteral: "SELECT",
359 wantChildren: 1,
360 },
361 }
362
363 for _, tt := range tests {
364 t.Run(tt.name, func(t *testing.T) {
365 // Test TokenLiteral
366 if got := tt.stmt.TokenLiteral(); got != tt.wantLiteral {
367 t.Errorf("StatementImpl.TokenLiteral() = %v, want %v", got, tt.wantLiteral)
368 }
369
370 // Test Children
371 children := tt.stmt.Children()
372 if len(children) != tt.wantChildren {
373 t.Errorf("StatementImpl.Children() count = %d, want %d", len(children), tt.wantChildren)
374 }
375
376 // Test statementNode
377 tt.stmt.statementNode()
378
379 // Test interface implementation
380 var _ Statement = tt.stmt
381 })
382 }
383}

Callers

nothing calls this directly

Calls 5

RunMethod · 0.80
TokenLiteralMethod · 0.65
ErrorfMethod · 0.65
ChildrenMethod · 0.65
statementNodeMethod · 0.65

Tested by

no test coverage detected