requireMatchingFieldExpression compares field expressions for equality, without descending into subexpressions
(t *testing.T, a, b FieldExpression)
| 247 | |
| 248 | // requireMatchingFieldExpression compares field expressions for equality, without descending into subexpressions |
| 249 | func requireMatchingFieldExpression(t *testing.T, a, b FieldExpression) { |
| 250 | t.Helper() |
| 251 | switch opA := a.(type) { |
| 252 | case *BinaryOperation: |
| 253 | if opB, ok := b.(*BinaryOperation); ok { |
| 254 | require.Equal(t, opA.Op, opB.Op) |
| 255 | } else { |
| 256 | require.Fail(t, "expected BinaryOperation, got %T", opB) |
| 257 | } |
| 258 | case *UnaryOperation: |
| 259 | if opB, ok := b.(*UnaryOperation); ok { |
| 260 | require.Equal(t, opA.Op, opB.Op) |
| 261 | } else { |
| 262 | require.Fail(t, "expected BinaryOperation, got %T", opB) |
| 263 | } |
| 264 | default: |
| 265 | require.Equal(t, a, b) |
| 266 | } |
| 267 | } |
no test coverage detected