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

Function TestOneOrManyWithParens

pkg/sql/ast/types_test.go:176–211  ·  view source on GitHub ↗

Test OneOrManyWithParens

(t *testing.T)

Source from the content-addressed store, hash-verified

174
175// Test OneOrManyWithParens
176func TestOneOrManyWithParens(t *testing.T) {
177 tests := []struct {
178 name string
179 parens *OneOrManyWithParens[*Ident]
180 wantLiteral string
181 wantChildren int
182 }{
183 {
184 name: "multiple identifiers",
185 parens: &OneOrManyWithParens[*Ident]{
186 Items: []*Ident{
187 {Name: "id"},
188 {Name: "name"},
189 {Name: "email"},
190 },
191 },
192 wantLiteral: "(",
193 wantChildren: 3,
194 },
195 }
196
197 for _, tt := range tests {
198 t.Run(tt.name, func(t *testing.T) {
199 // Test TokenLiteral
200 if got := tt.parens.TokenLiteral(); got != tt.wantLiteral {
201 t.Errorf("OneOrManyWithParens.TokenLiteral() = %v, want %v", got, tt.wantLiteral)
202 }
203
204 // Test Children
205 children := tt.parens.Children()
206 if len(children) != tt.wantChildren {
207 t.Errorf("OneOrManyWithParens.Children() count = %d, want %d", len(children), tt.wantChildren)
208 }
209 })
210 }
211}
212
213// Test WrappedCollection
214func TestWrappedCollection(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