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

[Feature]: e2e Event Assertion Failure Messages Should Include Both the Expected and the Actual Event Details #454

Open
1 task done
0xNeshi opened this issue Dec 13, 2024 · 0 comments
Labels
needs triage Needs to be assigned the appropriate labels type: feature New feature request. type: test Changes to the testing suite.

Comments

@0xNeshi
Copy link
Collaborator

0xNeshi commented Dec 13, 2024

What is the feature you would like to see?

What is the feature you would like to see?

Let's say the we assert an error occurred during contract execution like:

    assert!(receipt.emits(Erc20::Transfer {
        from: alice_addr,
        to: alice_addr,
        value: one,
    }));

And let's say when running the test that this assertion fails.

Currently, this would produce the following error message:

assertion failed: receipt.emits(Erc20::Transfer {
        from: alice_addr,
        to: alice_addr,
        value: one,
    })

A much more helpful error message would also show the actual error that occurred.

Proposal (open to suggestions):

assertion failed: receipt.emits(Erc20::Transfer {
        from: alice_addr,
        to: alice_addr,
        value: one,
    })

expected:
    Erc20::Transfer {
        from: 0xF4EaCDAbEf3c8f1EdE91b6f2A6840bc2E4DD3526,
        to: 0xF4EaCDAbEf3c8f1EdE91b6f2A6840bc2E4DD3526,
        value: 1_U256,
    })
actual:
    Erc20::Transfer {
        from: 0x0000000000000000000000000000000000000000,
        to: 0xF4EaCDAbEf3c8f1EdE91b6f2A6840bc2E4DD3526,
        value: 1_U256,
    })

Contribution Guidelines

  • I agree to follow this project's Contribution Guidelines
@0xNeshi 0xNeshi added type: feature New feature request. type: test Changes to the testing suite. needs triage Needs to be assigned the appropriate labels labels Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Needs to be assigned the appropriate labels type: feature New feature request. type: test Changes to the testing suite.
Projects
Status: Todo
Development

No branches or pull requests

1 participant