Test TableReference node
(t *testing.T)
| 284 | |
| 285 | // Test TableReference node |
| 286 | func TestTableReference(t *testing.T) { |
| 287 | tests := []struct { |
| 288 | name string |
| 289 | tableRef *TableReference |
| 290 | wantLiteral string |
| 291 | }{ |
| 292 | { |
| 293 | name: "simple table", |
| 294 | tableRef: &TableReference{Name: "users"}, |
| 295 | wantLiteral: "users", |
| 296 | }, |
| 297 | { |
| 298 | name: "table with alias", |
| 299 | tableRef: &TableReference{Name: "users", Alias: "u"}, |
| 300 | wantLiteral: "users", |
| 301 | }, |
| 302 | { |
| 303 | name: "qualified table name", |
| 304 | tableRef: &TableReference{Name: "schema.table"}, |
| 305 | wantLiteral: "schema.table", |
| 306 | }, |
| 307 | } |
| 308 | |
| 309 | for _, tt := range tests { |
| 310 | tt := tt // G601: Create local copy to avoid memory aliasing |
| 311 | t.Run(tt.name, func(t *testing.T) { |
| 312 | // Test TokenLiteral |
| 313 | if got := tt.tableRef.TokenLiteral(); got != tt.wantLiteral { |
| 314 | t.Errorf("TableReference.TokenLiteral() = %v, want %v", got, tt.wantLiteral) |
| 315 | } |
| 316 | |
| 317 | // Test Children |
| 318 | children := tt.tableRef.Children() |
| 319 | if children != nil { |
| 320 | t.Errorf("TableReference.Children() = %v, want nil", children) |
| 321 | } |
| 322 | |
| 323 | // Test that it implements Statement interface |
| 324 | var _ Statement = tt.tableRef |
| 325 | tt.tableRef.statementNode() |
| 326 | }) |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | // Test WindowSpec node |
| 331 | func TestWindowSpec(t *testing.T) { |
nothing calls this directly
no test coverage detected