Test DeleteStatement pool
(t *testing.T)
| 110 | |
| 111 | // Test DeleteStatement pool |
| 112 | func TestDeleteStatementPool(t *testing.T) { |
| 113 | t.Run("Get and Put", func(t *testing.T) { |
| 114 | // Get from pool |
| 115 | stmt := GetDeleteStatement() |
| 116 | if stmt == nil { |
| 117 | t.Fatal("GetDeleteStatement() returned nil") |
| 118 | } |
| 119 | |
| 120 | // Use it |
| 121 | stmt.TableName = "users" |
| 122 | stmt.Where = &BinaryExpression{ |
| 123 | Left: &Identifier{Name: "id"}, |
| 124 | Operator: "=", |
| 125 | Right: &LiteralValue{Value: "10"}, |
| 126 | } |
| 127 | |
| 128 | // Return to pool |
| 129 | PutDeleteStatement(stmt) |
| 130 | |
| 131 | // Verify it was cleaned |
| 132 | if stmt.TableName != "" { |
| 133 | t.Errorf("TableName not cleared, got %v", stmt.TableName) |
| 134 | } |
| 135 | if stmt.Where != nil { |
| 136 | t.Errorf("Where not cleared, got %v", stmt.Where) |
| 137 | } |
| 138 | }) |
| 139 | |
| 140 | t.Run("Put nil statement", func(t *testing.T) { |
| 141 | // Should not panic |
| 142 | PutDeleteStatement(nil) |
| 143 | }) |
| 144 | } |
| 145 | |
| 146 | // Test UpdateExpression pool |
| 147 | func TestUpdateExpressionPool(t *testing.T) { |
nothing calls this directly
no test coverage detected