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

Function TestExpressionSlicePool

pkg/sql/ast/ast_test.go:155–175  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

153}
154
155func TestExpressionSlicePool(t *testing.T) {
156 // Test getting an expression slice
157 slice1 := GetExpressionSlice()
158 if slice1 == nil {
159 t.Fatal("expected non-nil slice")
160 }
161 *slice1 = append(*slice1, &Identifier{Name: "test"})
162
163 // Release back to pool
164 PutExpressionSlice(slice1)
165
166 // Test getting another slice reuses the pool
167 slice2 := GetExpressionSlice()
168 if slice2 == nil {
169 t.Fatal("expected non-nil slice")
170 }
171 if len(*slice2) != 0 {
172 t.Errorf("expected empty slice after reset, got len %d", len(*slice2))
173 }
174 PutExpressionSlice(slice2)
175}
176
177func TestPutExpression(t *testing.T) {
178 // Test putting nil expression

Callers

nothing calls this directly

Calls 3

GetExpressionSliceFunction · 0.85
PutExpressionSliceFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected