Test over a simple expression
(t *testing.T)
| 25 | |
| 26 | // Test over a simple expression |
| 27 | func TestPatch_Count(t *testing.T) { |
| 28 | patcher := countingPatcher{} |
| 29 | |
| 30 | _, err := expr.Compile( |
| 31 | `5 + 5`, |
| 32 | expr.Env(mock.Env{}), |
| 33 | expr.Patch(&patcher), |
| 34 | ) |
| 35 | require.NoError(t, err) |
| 36 | |
| 37 | require.Equal(t, 2, patcher.PatchCount, "Patcher run an unexpected number of times during compile") |
| 38 | } |
| 39 | |
| 40 | // Test with operator overloading |
| 41 | func TestPatchOperator_Count(t *testing.T) { |