Test WrappedCollection
(t *testing.T)
| 212 | |
| 213 | // Test WrappedCollection |
| 214 | func 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 |
| 252 | func TestClusteredBy(t *testing.T) { |
nothing calls this directly
no test coverage detected