(t *testing.T)
| 122 | } |
| 123 | |
| 124 | func TestBinaryExpressionPool(t *testing.T) { |
| 125 | // Test getting a BinaryExpression |
| 126 | expr1 := GetBinaryExpression() |
| 127 | if expr1 == nil { |
| 128 | t.Fatal("expected non-nil BinaryExpression") |
| 129 | } |
| 130 | |
| 131 | expr1.Left = &Identifier{Name: "id"} |
| 132 | expr1.Operator = "=" |
| 133 | expr1.Right = &Identifier{Name: "1"} |
| 134 | |
| 135 | // Release back to pool |
| 136 | PutBinaryExpression(expr1) |
| 137 | |
| 138 | // Test getting another BinaryExpression reuses the pool |
| 139 | expr2 := GetBinaryExpression() |
| 140 | if expr2 == nil { |
| 141 | t.Fatal("expected non-nil BinaryExpression") |
| 142 | } |
| 143 | if expr2.Left != nil { |
| 144 | t.Error("expected nil Left after reset") |
| 145 | } |
| 146 | if expr2.Right != nil { |
| 147 | t.Error("expected nil Right after reset") |
| 148 | } |
| 149 | if expr2.Operator != "" { |
| 150 | t.Errorf("expected empty operator after reset, got %q", expr2.Operator) |
| 151 | } |
| 152 | PutBinaryExpression(expr2) |
| 153 | } |
| 154 | |
| 155 | func TestExpressionSlicePool(t *testing.T) { |
| 156 | // Test getting an expression slice |
nothing calls this directly
no test coverage detected