Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot check negative expectCall assertion with any other expectCall assertion. #5655

Closed
2 tasks done
simplyoptimistic opened this issue Aug 18, 2023 · 1 comment
Closed
2 tasks done
Labels
T-bug Type: bug

Comments

@simplyoptimistic
Copy link

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (11b08e9 2023-08-16T00:24:01.780465000Z)

What command(s) is the bug in?

forge test

Operating System

macOS (Apple Silicon)

Describe the bug

count was added to expectCall here: #4833

It allows for the ability to check that a function isn't called, by checking count == 0. Because of the way negative assertions have been implemented, it is not possible to combine them with other assertions around whether a function has been called or not, as you will receive this error:

[FAIL. Reason: Counted expected calls can only bet set once.] < also notice the typo

Whereas it would be possible to check in a test that different functions are being called by doing something like this:

vm.expectCall(where, data);
f.X();

vm.expectCall(where, data);
f.Y();

Where, where and data can be the same in both cases, and X() and Y() can be the same in both cases. It fails even if you do the following:

vm.expectCall(where, data)
vm.expectCall(where, data, count=0)

with the same error as above.

@simplyoptimistic simplyoptimistic added the T-bug Type: bug label Aug 18, 2023
@gakonst gakonst added this to Foundry Aug 18, 2023
@github-project-automation github-project-automation bot moved this to Todo in Foundry Aug 18, 2023
@Evalir
Copy link
Member

Evalir commented Aug 18, 2023

note that this is not a bug, an intended behavior—this is actually a duplicate of #509

closing to consolidate issues

@Evalir Evalir closed this as completed Aug 18, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Foundry Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-bug Type: bug
Projects
Archived in project
Development

No branches or pull requests

2 participants