Skip to content
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

Change tests to support rustc wording changes #14135

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/testsuite/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ fn rustc_check_err() {
.with_status(101)
.with_stderr_contains("[CHECKING] bar [..]")
.with_stderr_contains("[CHECKING] foo [..]")
.with_stderr_contains("[..]cannot find function `qux` in [..] `bar`")
.with_stderr_contains("[..]cannot find function `qux`[..]")
Copy link
Member

Choose a reason for hiding this comment

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

Should we stop asserting the string, and instead check only the appearance of E0425? I feel like the error code will always be there, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The error code will indeed always be there. I'm ok with either approach.

Copy link
Member

Choose a reason for hiding this comment

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

@epage
Any opinion on adding a redaction for the first line rustc diagnostic message? Something like

error[E0425]: [RUSTC_ERROR_MESSAGE]

We still need to use ... to omit the multiline sub-diagnostics though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting, not a bad idea, but you can already accomplish that with error[E025]: [..] right?

Copy link
Contributor

Choose a reason for hiding this comment

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

So we only match on the error number and not the error message? I guess that would be specific enough.

Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting, not a bad idea, but you can already accomplish that with error[E025]: [..] right?

The more we can auto-redact, the easier to is to write new tests and do the right thing (or update existing tests)

.with_stderr_contains("[..]in crate `bar`")
.run();
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/message_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ test src/lib.rs - bar (line 1) ... FAILED
failures:

---- src/lib.rs - bar (line 1) stdout ----
src/lib.rs:2:1: error[E0425]: cannot find function `bar` in this scope
src/lib.rs:2:1: error[E0425]: cannot find function `bar`[..]
[ERROR] aborting due to 1 previous error
Couldn't compile the test.

Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/metabuild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ fn metabuild_failed_build_json() {
"children": "{...}",
"code": "{...}",
"level": "error",
"message": "cannot find function `metabuild` in [..] `mb`",
"message": "cannot find function `metabuild`[..]",
"rendered": "{...}",
"spans": "{...}"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ fn override_respects_spec_metadata() {
[DOWNLOADED] bar v0.1.0+a (registry `dummy-registry`)
[CHECKING] bar v0.1.0+a
[CHECKING] foo v0.0.1 ([ROOT]/foo)
error[E0425]: cannot find function `bar` in crate `bar`
error[E0425]: cannot find function `bar`[..]
...
[ERROR] could not compile `foo` (lib) due to 1 previous error

Expand Down