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

Function TestUpdateExpressionPool

pkg/sql/ast/pool_test.go:147–175  ·  view source on GitHub ↗

Test UpdateExpression pool

(t *testing.T)

Source from the content-addressed store, hash-verified

145
146// Test UpdateExpression pool
147func TestUpdateExpressionPool(t *testing.T) {
148 t.Run("Get and Put", func(t *testing.T) {
149 // Get from pool
150 expr := GetUpdateExpression()
151 if expr == nil {
152 t.Fatal("GetUpdateExpression() returned nil")
153 }
154
155 // Use it
156 expr.Column = &Identifier{Name: "status"}
157 expr.Value = &LiteralValue{Value: "active"}
158
159 // Return to pool
160 PutUpdateExpression(expr)
161
162 // Verify it was cleaned
163 if expr.Column != nil {
164 t.Errorf("Column not cleared, got %v", expr.Column)
165 }
166 if expr.Value != nil {
167 t.Errorf("Value not cleared, got %v", expr.Value)
168 }
169 })
170
171 t.Run("Put nil expression", func(t *testing.T) {
172 // Should not panic
173 PutUpdateExpression(nil)
174 })
175}
176
177// Test LiteralValue pool
178func TestLiteralValuePool(t *testing.T) {

Callers

nothing calls this directly

Calls 4

GetUpdateExpressionFunction · 0.85
PutUpdateExpressionFunction · 0.85
RunMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected