Test ClusteredBy
(t *testing.T)
| 250 | |
| 251 | // Test ClusteredBy |
| 252 | func TestClusteredBy(t *testing.T) { |
| 253 | tests := []struct { |
| 254 | name string |
| 255 | clustered *ClusteredBy |
| 256 | wantLiteral string |
| 257 | wantChildren int |
| 258 | }{ |
| 259 | { |
| 260 | name: "clustered by columns", |
| 261 | clustered: &ClusteredBy{ |
| 262 | Columns: []Node{ |
| 263 | &Identifier{Name: "user_id"}, |
| 264 | &Identifier{Name: "created_at"}, |
| 265 | }, |
| 266 | Buckets: 10, |
| 267 | }, |
| 268 | wantLiteral: "CLUSTERED BY", |
| 269 | wantChildren: 2, |
| 270 | }, |
| 271 | } |
| 272 | |
| 273 | for _, tt := range tests { |
| 274 | t.Run(tt.name, func(t *testing.T) { |
| 275 | // Test TokenLiteral |
| 276 | if got := tt.clustered.TokenLiteral(); got != tt.wantLiteral { |
| 277 | t.Errorf("ClusteredBy.TokenLiteral() = %v, want %v", got, tt.wantLiteral) |
| 278 | } |
| 279 | |
| 280 | // Test Children |
| 281 | children := tt.clustered.Children() |
| 282 | if len(children) != tt.wantChildren { |
| 283 | t.Errorf("ClusteredBy.Children() count = %d, want %d", len(children), tt.wantChildren) |
| 284 | } |
| 285 | }) |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | // Mock Expr for testing |
| 290 | type mockExpr struct{} |
nothing calls this directly
no test coverage detected