Skip to content

Integration test updates - #7196

Open
matthewhughes934 wants to merge 2 commits into
rust-lang:mainfrom
matthewhughes934:integration-test-updates
Open

matthewhughes934 wants to merge 2 commits into
rust-lang:mainfrom
matthewhughes934:integration-test-updates

Conversation

@matthewhughes934

Copy link
Copy Markdown
Contributor
  • Rewrite --print-config integration tests

    The main thing here is to be more explicit on assertions: e.g. to answer
    are we expecting something to be printed to stdout or stderr?

    I thought about rewriting the existing macro to handle this case too,
    but couldn't find a good approach for that, and decided that the
    plain code, while more lines, was more readable.

  • Update config discovery integration tests

    Firstly, Simplify the directory structure: we only need a single package here,
    so drag everything up for that. Secondly, make it more explicit exactly
    which config we expect to read by setting up configs with different
    options, rather than just ignoring all formatting.

    Also add tests for other existing behaviour: searching in HOME and
    XDG_CONFIG_HOME when no config is given nor found.

  • I did not use an LLM to create a change in this PR.

  • I used an LLM to create a change in this PR, and I have explained below how it was used.

@rustbot rustbot added the S-waiting-on-review Status: awaiting review from the assignee but also interested parties. label Oct 18, 2026
Comment thread tests/config/issue_4660/rustfmt.toml Outdated
Comment thread tests/rustfmt/main.rs
@ytmimi ytmimi self-assigned this Oct 18, 2026
@matthewhughes934
matthewhughes934 force-pushed the integration-test-updates branch 3 times, most recently from 8e4b0a2 to 17eb303 Compare October 19, 2026 18:30
@jieyouxu jieyouxu self-assigned this Oct 20, 2026

@jieyouxu jieyouxu left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks sensible. Some nits
@rustbot author

View changes since this review

Comment thread tests/rustfmt/main.rs Outdated
Comment on lines +90 to +91
// NOTE: existing the behaviour, possibly a bug
assert_eq!(&stdout, "\n");

@jieyouxu jieyouxu Oct 20, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Huh, interesting... I feel like this is a bug, I sense that the .trim() you added later is just papering over the newline coming from somewhere.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Huh, interesting... I feel like this is a bug, I sense that the .trim() you added later is just papering over the newline coming from somewhere.

Yeah, I plan to address this in a followup, just wanted to make this change about restructuring the tests

Comment thread tests/rustfmt/main.rs
remove_file("minimal-config").unwrap();
}

// test writes to file within the repo, rust-lang/rust doesn't like that

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we use a tempdir instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Could we use a tempdir instead?

👍 Another one for my followup

Comment thread tests/config/issue_4660/src/lib.rs Outdated
Comment thread tests/rustfmt/main.rs
Comment thread tests/rustfmt/main.rs
@@ -113,7 +113,16 @@ fn print_config_errors_minimal_without_input_file() {
#[test]
fn print_config_writes_to_file() {

@jieyouxu jieyouxu Oct 20, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Presumably we need to also make sure we remove the file if it existed -- otherwise you can get a false green locally from a previous run even if you completely break the logic.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Presumably we need to also make sure we remove the file if it existed -- otherwise you can get a false green locally from a previous run even if you completely break the logic.

View changes since the review

👍 yep, one more for the followup

@rustbot rustbot added S-waiting-on-author Status: awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: awaiting review from the assignee but also interested parties. labels Oct 20, 2026
@rustbot

rustbot commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@jieyouxu jieyouxu left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks. This looks good to me.

I'm holding off on merging to prioritize the subtree sync, in case we need to force-push away the latest 3 subtree pull commits.

View changes since this review

@jieyouxu jieyouxu added S-waiting-on-review Status: awaiting review from the assignee but also interested parties. pr-ready-to-merge Status: PR is largely ready for merge, waiting for secondary review / last nits and removed S-waiting-on-author Status: awaiting some action (such as code changes or more information) from the author. labels Oct 20, 2026
The main thing here is to be more explicit on assertions: e.g. to answer
are we expecting something to be printed to stdout or stderr?

I thought about rewriting the existing macro to handle this case too,
but couldn't find a good approach for that, and decided that the
plain code, while more lines, was more readable.
Firstly, Simplify the directory structure: we only need a single package here,
so drag everything up for that. Secondly, make it more explicit exactly
which config we expect to read by setting up configs with different
options, rather than just ignoring all formatting.

Also add tests for other existing behaviour: searching in `HOME` and
`XDG_CONFIG_HOME` when no config is given nor found.
@matthewhughes934
matthewhughes934 force-pushed the integration-test-updates branch from a30acc8 to a8bf62d Compare October 20, 2026 17:05
@rustbot

rustbot commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

This branch has not been deployed

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

Labels

pr-ready-to-merge Status: PR is largely ready for merge, waiting for secondary review / last nits S-waiting-on-review Status: awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants