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

test: Add auto-redaction for not found error #14124

Merged
merged 1 commit into from
Jun 21, 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
12 changes: 12 additions & 0 deletions crates/cargo-test-support/src/compare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,18 @@ static MIN_LITERAL_REDACTIONS: &[(&str, &str)] = &[
("[EXE]", std::env::consts::EXE_SUFFIX),
("[BROKEN_PIPE]", "Broken pipe (os error 32)"),
("[BROKEN_PIPE]", "The pipe is being closed. (os error 232)"),
// Unix message for an entity was not found
("[NOT_FOUND]", "No such file or directory (os error 2)"),
// Windows message for an entity was not found
(
"[NOT_FOUND]",
"The system cannot find the file specified. (os error 2)",
),
(
"[NOT_FOUND]",
"The system cannot find the path specified. (os error 3)",
),
("[NOT_FOUND]", "program not found"),
epage marked this conversation as resolved.
Show resolved Hide resolved
epage marked this conversation as resolved.
Show resolved Hide resolved
// Unix message for exit status
("[EXIT_STATUS]", "exit status"),
// Windows message for exit status
Expand Down
8 changes: 3 additions & 5 deletions tests/testsuite/config_include.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//! Tests for `include` config field.

use super::config::{assert_error, write_config_at, write_config_toml, GlobalContextBuilder};
use cargo_test_support::project;
use cargo_test_support::str;
use cargo_test_support::{no_such_file_err_msg, project};

#[cargo_test]
fn gated() {
Expand Down Expand Up @@ -162,8 +162,7 @@ Caused by:
failed to read configuration file `[..]/.cargo/missing.toml`

Caused by:
{}",
no_such_file_err_msg()
[NOT_FOUND]",
),
);
}
Expand Down Expand Up @@ -270,8 +269,7 @@ Caused by:
failed to read configuration file `[..]/foobar.toml`

Caused by:
{}",
no_such_file_err_msg()
[NOT_FOUND]"
),
);
}
Expand Down