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

Function TestLiteralValuePool

pkg/sql/ast/pool_test.go:178–202  ·  view source on GitHub ↗

Test LiteralValue pool

(t *testing.T)

Source from the content-addressed store, hash-verified

176
177// Test LiteralValue pool
178func TestLiteralValuePool(t *testing.T) {
179 t.Run("Get and Put", func(t *testing.T) {
180 // Get from pool
181 lit := GetLiteralValue()
182 if lit == nil {
183 t.Fatal("GetLiteralValue() returned nil")
184 }
185
186 // Use it
187 lit.Value = "test_value"
188
189 // Return to pool
190 PutLiteralValue(lit)
191
192 // Verify it was cleaned (Value is interface{}, should be nil)
193 if lit.Value != nil {
194 t.Errorf("Value not cleared, got %v", lit.Value)
195 }
196 })
197
198 t.Run("Put nil literal", func(t *testing.T) {
199 // Should not panic
200 PutLiteralValue(nil)
201 })
202}
203
204// Test pool reuse
205func TestPoolReuse(t *testing.T) {

Callers

nothing calls this directly

Calls 4

GetLiteralValueFunction · 0.85
PutLiteralValueFunction · 0.85
RunMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected