Skip to content

test: finish migration to .expect() APIs #4376

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

Merged
merged 6 commits into from
Jun 9, 2025
Merged

Conversation

rami3l
Copy link
Member

@rami3l rami3l commented Jun 7, 2025

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR completes the migration of the test suite to the new .expect() APIs and cleans up related helper code.

  • Updated all test modules (cli_self_upd, cli_rustup, cli_misc, and cli_exact) to use the .expect()/.expect_with_env() pattern with chained .await, .is_ok()/.is_err(), and .with_stdout()/.with_stderr().
  • Enhanced the Assert type in src/test/clitools.rs with redact() and remove_redactions() methods, removed deprecated assertion helpers, and made its output field public.
  • Removed the now-unneeded similar_asserts dependency and deprecated run()-based helpers from Config, updating Cargo.toml accordingly.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/suite/cli_self_upd.rs Switched to .expect() API and cleaned up redactions
tests/suite/cli_rustup.rs Replaced run() with .expect*() calls and simplified redaction args
tests/suite/cli_misc.rs Introduced assert_ok_with_paths helper and moved to .expect() API
tests/suite/cli_exact.rs Converted pre-test run() calls to .expect(...).is_ok()
src/test/clitools.rs Added redact/remove_redactions, exposed output, removed deprecated helpers
Cargo.toml Dropped similar-asserts from the test feature

@rami3l rami3l requested review from djc and ChrisDenton June 7, 2025 15:48
@@ -1393,10 +1393,27 @@ async fn override_by_toolchain_on_the_command_line() {

"#]])
.is_ok();
cx.config
Copy link
Member Author

@rami3l rami3l Jun 7, 2025

Choose a reason for hiding this comment

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

These assertions were accidentally deleted by me in the previous PR #4363, the original intent being merging Windows and Unix tests now that snapbox would automatically replace \ with /. However, I obviously deleted more than what was needed...

@rami3l rami3l force-pushed the test/fixup branch 2 times, most recently from 2ab9d63 to bddde00 Compare June 8, 2025 02:22
Copy link
Member

@ChrisDenton ChrisDenton left a comment

Choose a reason for hiding this comment

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

Looks good to me! And thank you for completing this whole migration 🎉

@rami3l
Copy link
Member Author

rami3l commented Jun 9, 2025

@ChrisDenton Many thanks to you and @djc for the review as well! 🙏

@rami3l rami3l added this pull request to the merge queue Jun 9, 2025
Merged via the queue into rust-lang:master with commit c4adcc2 Jun 9, 2025
29 checks passed
@rami3l rami3l deleted the test/fixup branch June 9, 2025 14:11
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.

Tracking: Migrate to snapshot-based integration testing APIs
2 participants