(feat): merging analysis tests#9872
Conversation
PR SummaryLow Risk Overview Replaces bespoke test-side formatting by adding custom Reviewed by Cursor Bugbot for commit 5444b1b. Bugbot is set up for automated code reviews on this repo. Configure here. |
orizi
left a comment
There was a problem hiding this comment.
@orizi made 1 comment.
Reviewable status: 0 of 7 files reviewed, 1 unresolved discussion (waiting on eytan-starkware and TomerStarkware).
crates/cairo-lang-lowering/src/analysis/test.rs line 29 at r1 (raw file):
"src/analysis/test_data", { dom: "dom",
inator
aeb10da to
5d2a519
Compare
89d473e to
77540f0
Compare
5d2a519 to
4685881
Compare
eytan-starkware
left a comment
There was a problem hiding this comment.
@eytan-starkware made 1 comment.
Reviewable status: 0 of 11 files reviewed, 1 unresolved discussion (waiting on orizi and TomerStarkware).
crates/cairo-lang-lowering/src/analysis/test.rs line 29 at r1 (raw file):
Previously, orizi wrote…
inator
Done.
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 11 files and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on eytan-starkware and TomerStarkware).
crates/cairo-lang-lowering/src/analysis/test.rs line 260 at r2 (raw file):
ConcreteFunctionWithBodyId::from_semantic(db, test_function.concrete_function_id); let mut lowered = db.lowered_body(function_id, LoweringStage::PostBaseline).cloned().unwrap(); let extra = lowered.variables.iter().next().unwrap().1.clone();
doc this is the actual interesting line.
Code quote:
let extra = lowered.variables.iter().next().unwrap().1.clone();4685881 to
58b48e9
Compare
eytan-starkware
left a comment
There was a problem hiding this comment.
@eytan-starkware made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on orizi and TomerStarkware).
crates/cairo-lang-lowering/src/analysis/test.rs line 260 at r2 (raw file):
Previously, orizi wrote…
doc this is the actual interesting line.
Done.
58b48e9 to
5444b1b
Compare
orizi
left a comment
There was a problem hiding this comment.
@orizi reviewed 1 file and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on TomerStarkware).

Summary
Consolidates the separate
def_site_test.rsanddom_test.rstest modules into a single unifiedtest_analysisrunner intest.rs. The new runner dispatches to the appropriate analysis (domordef_site) based on ananalysisarg declared in each test data file. ADisplayimplementation is added toDominatorsso it can render its own output, removing the inline formatting logic that previously lived in the test module. Test data files are updated to usetest_analysis(analysis: dom)andtest_analysis(analysis: def_site)as their runner names, and thedominatorsoutput section is renamed toresultfor consistency across both analyses.Type of change
Please check one:
Why is this change needed?
The two analysis test modules (
def_site_test.rsanddom_test.rs) were nearly identical in structure, each duplicating the same boilerplate for setting up the database, lowering the function, and writing results. Adding a new analysis required creating an entirely new test module. The unified runner reduces duplication and makes it trivial to add new analyses with only a new match arm and a test data file.What was the behavior or documentation before?
Each analysis had its own dedicated test module with its own
test_file_test!macro invocation, its own runner function, and its own output key name (dominatorsfor dom,resultfor def_site).What is the behavior or documentation after?
A single
test_analysisrunner handles all file-based analysis tests. Theanalysisarg in each test data file selects which analysis to run. All analyses use a uniformresultoutput key.DominatorsimplementsDisplaydirectly rather than relying on ad-hoc formatting in the test module.Related issue or discussion (if any)
Additional context
Adding support for a new analysis in the future only requires a new match arm in
test_analysisand a correspondingtest_data/<name>file — no new test module needed.