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

Function TestWrappedCollection

pkg/sql/ast/types_test.go:214–249  ·  view source on GitHub ↗

Test WrappedCollection

(t *testing.T)

Source from the content-addressed store, hash-verified

212
213// Test WrappedCollection
214func TestWrappedCollection(t *testing.T) {
215 tests := []struct {
216 name string
217 wrapped *WrappedCollection[*Ident]
218 wantLiteral string
219 wantChildren int
220 }{
221 {
222 name: "wrapped identifiers",
223 wrapped: &WrappedCollection[*Ident]{
224 Items: []*Ident{
225 {Name: "col1"},
226 {Name: "col2"},
227 },
228 Wrapper: "COLUMNS",
229 },
230 wantLiteral: "COLUMNS",
231 wantChildren: 2,
232 },
233 }
234
235 for _, tt := range tests {
236 t.Run(tt.name, func(t *testing.T) {
237 // Test TokenLiteral
238 if got := tt.wrapped.TokenLiteral(); got != tt.wantLiteral {
239 t.Errorf("WrappedCollection.TokenLiteral() = %v, want %v", got, tt.wantLiteral)
240 }
241
242 // Test Children
243 children := tt.wrapped.Children()
244 if len(children) != tt.wantChildren {
245 t.Errorf("WrappedCollection.Children() count = %d, want %d", len(children), tt.wantChildren)
246 }
247 })
248 }
249}
250
251// Test ClusteredBy
252func TestClusteredBy(t *testing.T) {

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