Skip to content

Show syscall/builtin difference on assertion failure#4501

Open
franciszekjob wants to merge 8 commits into
franciszekjob/4484-show-expected-vs-actual-gasfrom
franciszekjob/show-expected-vs-actual-builtins
Open

Show syscall/builtin difference on assertion failure#4501
franciszekjob wants to merge 8 commits into
franciszekjob/4484-show-expected-vs-actual-gasfrom
franciszekjob/show-expected-vs-actual-builtins

Conversation

@franciszekjob

@franciszekjob franciszekjob commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Closes #4484

Introduced changes

Before

image

After

image

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added relevant tests
  • Performed self-review of the code
  • Added changes to CHANGELOG.md

@franciszekjob

Copy link
Copy Markdown
Contributor Author

@franciszekjob
franciszekjob force-pushed the franciszekjob/show-expected-vs-actual-builtins branch from e4a9e43 to 14917c6 Compare July 20, 2026 08:04
@franciszekjob franciszekjob changed the title Show expected/actual on syscall, builtin and output assertion failures Show syscall/builtin difference on assertion failure Jul 20, 2026
@franciszekjob
franciszekjob force-pushed the franciszekjob/show-expected-vs-actual-builtins branch 2 times, most recently from a1c8a2f to 02e186c Compare July 20, 2026 09:13
franciszekjob and others added 5 commits July 20, 2026 11:32
Mirror `assert_gas`: `assert_syscall`, `assert_builtin` and `assert_case_output_contains` now report the expected and actual value on mismatch, so failures surface the value the source should hold. The `range_check` off-by-one is normalized into the observed count so the printed `actual` equals the source expectation verbatim.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@franciszekjob
franciszekjob force-pushed the franciszekjob/show-expected-vs-actual-builtins branch from 6ccb1e3 to 0354d36 Compare July 20, 2026 09:32
@franciszekjob
franciszekjob marked this pull request as ready for review July 20, 2026 09:57
@franciszekjob
franciszekjob requested a review from a team as a code owner July 20, 2026 09:57
@franciszekjob
franciszekjob requested review from DelevoXDG and ddoktorski and removed request for a team July 20, 2026 09:57
use shared::test_utils::output_assert::assert_stdout_contains;
use std::path::Path;

#[test]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to my note on the previous PR, this file is meant for Forge resources integration tests, so we probably shouldn't mix in tests for test utilities here. We could either move them to a separate file or drop them entirely since they aren't testing tool logic.

Comment on lines +458 to +459
.unwrap_or(&SyscallUsage::new(0, 0))
.call_count;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.unwrap_or(&SyscallUsage::new(0, 0))
.call_count;
.map_or(0, |usage| usage.call_count);

Comment on lines +533 to +534
fn format_available_test_cases(result: &[AnyTestCaseSummary]) -> String {
result

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
fn format_available_test_cases(result: &[AnyTestCaseSummary]) -> String {
result
fn format_available_test_cases(summaries: &[AnyTestCaseSummary]) -> String {
summaries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants