Test LiteralValue pool
(t *testing.T)
| 176 | |
| 177 | // Test LiteralValue pool |
| 178 | func 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 |
| 205 | func TestPoolReuse(t *testing.T) { |
nothing calls this directly
no test coverage detected