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

Function TestClusteredBy

pkg/sql/ast/types_test.go:252–287  ·  view source on GitHub ↗

Test ClusteredBy

(t *testing.T)

Source from the content-addressed store, hash-verified

250
251// Test ClusteredBy
252func 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
290type mockExpr struct{}

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected