From cf5a78c0e1cdd6247484ca80c5c412706f76c965 Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Wed, 5 Mar 2025 23:24:18 +0200 Subject: [PATCH 1/2] Check content of the error message in ask_the_preprocessor_to_blow_up --- tests/custom_preprocessors.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/custom_preprocessors.rs b/tests/custom_preprocessors.rs index 8237602d..db29a729 100644 --- a/tests/custom_preprocessors.rs +++ b/tests/custom_preprocessors.rs @@ -43,6 +43,11 @@ fn ask_the_preprocessor_to_blow_up() { let got = md.build(); assert!(got.is_err()); + let error_message = got.err().unwrap().to_string(); + assert_eq!( + error_message, + r#"The "nop-preprocessor" preprocessor exited unsuccessfully with exit status: 1 status"# + ); } #[test] From 32daca669aa279b96423132cbbf79c693584c0cb Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Thu, 6 Mar 2025 07:25:51 +0200 Subject: [PATCH 2/2] Accomodate for different status message on Windows Alternatively we could change the error message to only include take the status code from the os by using output.status.code().unwrap() in preprocess/cmd.rs where this error message is generated. In that case we could have the exact same error message on all the OS-es. --- tests/custom_preprocessors.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/custom_preprocessors.rs b/tests/custom_preprocessors.rs index db29a729..c32e94d3 100644 --- a/tests/custom_preprocessors.rs +++ b/tests/custom_preprocessors.rs @@ -44,9 +44,16 @@ fn ask_the_preprocessor_to_blow_up() { assert!(got.is_err()); let error_message = got.err().unwrap().to_string(); + let status = if cfg!(windows) { + "exit code: 1" + } else { + "exit status: 1" + }; assert_eq!( error_message, - r#"The "nop-preprocessor" preprocessor exited unsuccessfully with exit status: 1 status"# + format!( + r#"The "nop-preprocessor" preprocessor exited unsuccessfully with {status} status"# + ) ); }