Skip to content

Commit

Permalink
refactor - tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rufevean committed Sep 7, 2024
1 parent 0306b8e commit 6165b3d
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions tests/rustfmt/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,16 @@ fn rustfmt_generates_no_error_if_failed_format_code_in_doc_comments() {
assert!(stderr.is_empty());
assert!(stdout.is_empty());
}

#[test]
fn rustfmt_error_improvement_regarding_invalid_toml() {
// See also https://github.com/rust-lang/rustfmt/issues/6302
let args = ["--config-path", "tests/config/issue-6302.toml"];
let invalid_toml_config = "tests/config/issue-6302.toml";
let args = ["--config-path", invalid_toml_config];
let (_stdout, stderr) = rustfmt(&args);

let expected_error_message = "The file `rustfmt/tests/config/issue-6302.toml` failed to parse.\n Error details: invalid type: integer `2019`, expected string in `edition`";
let toml_path = Path::new(invalid_toml_config).canonicalize().unwrap();
let expected_error_message = format!("The file `{}` failed to parse", toml_path.display());

assert!(
stderr.contains(expected_error_message),
"Unexpected error message.\nExpected:\n{}\nGot:\n{}",
expected_error_message,
stderr
);
assert!(stderr.contains(&expected_error_message));
}

0 comments on commit 6165b3d

Please sign in to comment.