Test StatementImpl
(t *testing.T)
| 340 | |
| 341 | // Test StatementImpl |
| 342 | func 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 | } |
nothing calls this directly
no test coverage detected