Skip to content

Commit fda3c08

Browse files
committed
use pretty printed diff for integration test too.
1 parent 782b3a1 commit fda3c08

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

cpp-linter/tests/comments.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![cfg(feature = "bin")]
22
use chrono::Utc;
3+
use clap::builder::styling::{AnsiColor, Color, Style};
34
use cpp_linter::rest_client::USER_OUTREACH;
45
use cpp_linter::run::run_main;
56
use cpp_linter::{cli::ThreadComments, rest_client::COMMENT_MARKER};
@@ -310,7 +311,17 @@ async fn setup(lib_root: &Path, tmp_dir: &TempDir, test_params: &TestParams) {
310311
);
311312
let patch_content =
312313
std::fs::read_to_string(patch_path).expect("Failed to read generated patch file.");
313-
println!("Generated patch content:\n{patch_content}");
314+
println!("Generated patch content:");
315+
for l in patch_content.lines() {
316+
let style = if l.starts_with('+') {
317+
Style::new().fg_color(Some(Color::Ansi(AnsiColor::Green))) // Green for additions
318+
} else if l.starts_with('-') {
319+
Style::new().fg_color(Some(Color::Ansi(AnsiColor::Red))) // Red for deletions
320+
} else {
321+
Style::new() // Default style for context lines
322+
};
323+
println!("{style}{l}{style:#}");
324+
}
314325
}
315326

316327
let summary_out_file_abs_path = if test_params.relative_summary_out_file {

0 commit comments

Comments
 (0)