test: convert assertions to inline snapshots across the codebase#672
Closed
MatthewMckee4 wants to merge 7 commits intotest/consolidated-auditfrom
Closed
test: convert assertions to inline snapshots across the codebase#672MatthewMckee4 wants to merge 7 commits intotest/consolidated-auditfrom
MatthewMckee4 wants to merge 7 commits intotest/consolidated-auditfrom
Conversation
…r coverage Removes two non-snapshot fail-fast tests in basic.rs that duplicated the existing snapshot-based coverage, deletes trivial unit tests in function_kind.rs and a helper-formula test module in orchestration.rs that was testing a copy of the production logic, and adds an integration test covering the last-failed plus filterset workflow.
Adds 32 new integration tests covering CLI flag combinations and orchestration behaviours that were either untested or only had a happy path. The additions are spread across basic, last_failed, configuration, and a new discovery/edge_cases module.
Converts the hand-written equality checks in `format_duration` and `format_duration_bracketed` tests to inline snapshots so intentional format changes can be updated in bulk via `cargo insta review`.
Converts `filter_traceback`, `parse_traceback_line`, `get_traceback_location`, and `calculate_line_range` unit tests to inline snapshots. These assert on multi-line strings and `Option<TracebackLocation>` / `Option<TextRange>` structs where seeing the full parsed shape is much easier to review than hand-built expected values.
Converts the TOML parsing and `Combine` merge tests on `Options`, `TestOptions`, and `SrcOptions` to debug snapshots of the full struct. The hand-written per-field asserts previously checked a handful of fields in each merged struct; the snapshot form pins down every field at once so intentional schema changes regenerate cleanly.
Merging this PR will not alter performance
|
c312ef1 to
ccee0f2
Compare
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Converts hand-written
assert_eq!checks acrosskarva_logging,karva_diagnostic, andkarva_metadatato inline insta snapshots. Inkarva_logging/time.rstheformat_duration/format_duration_bracketedtests now pin the exact formatted string. Inkarva_diagnostic/traceback.rsthefilter_traceback,parse_traceback_line,get_traceback_location, andcalculate_line_rangetests snapshot the full parsedOption<TracebackLocation>/Option<TextRange>shapes instead of building them by hand. Inkarva_metadata/options.rsthe TOML-parsing andCombinemerge tests now snapshot the whole struct so every field is pinned, not just the three or four that were previously checked.Assertions were left as-is where a snapshot would not help: single-integer or single-enum-variant comparisons (e.g.
MaxFailandRunHashtests),matches!-style property checks onTestPathvariants,is_ok/is_err/len/is_emptychecks in the cache and diagnostic stats tests, and roundtrip tests where the entire point is equality. The base branch istest/consolidated-audit(PR #670) so the diff reviews against just this sweep.Test Plan
just test(888 tests pass)uvx prek run -a(all hooks pass)