Skip to content

Commit

Permalink
Add failing test of hunk header with file and no frag
Browse files Browse the repository at this point in the history
Ref #309
  • Loading branch information
dandavison committed Dec 26, 2020
1 parent 2b140ae commit 91f1440
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/tests/test_example_diffs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,28 @@ src/align.rs: impl<'a> Alignment<'a> { │
"
));
}

#[test]
fn test_hunk_header_style_with_file_no_frag() {
let config = integration_test_utils::make_config_from_args(&[
"--file-style",
"yellow",
"--hunk-header-style",
"file red",
"--hunk-header-decoration-style",
"box",
]);
let output = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK_NO_FRAG, &config);

ansi_test_utils::assert_line_has_style(&output, 5, "src/delta.rs", "yellow", &config);
let output = strip_ansi_codes(&output);
assert!(output.contains(
"
─────────────┐
src/delta.rs │
─────────────┘
"
));
}

#[test]
Expand Down Expand Up @@ -1492,6 +1514,18 @@ index 8e37a9e..6ce4863 100644
parent: left,
";

const GIT_DIFF_SINGLE_HUNK_NO_FRAG: &str = "\
diff --git a/src/delta.rs b/src/delta.rs
index e401e269..e5304e01 100644
--- a/src/delta.rs
+++ b/src/delta.rs
@@ -1,4 +1,3 @@
-use std::borrow::Cow;
use std::fmt::Write as FmtWrite;
use std::io::BufRead;
use std::io::Write;
";

const GIT_DIFF_SINGLE_HUNK_WITH_ANSI_ESCAPE_SEQUENCES: &str = "\
commit 94907c0f136f46dc46ffae2dc92dca9af7eb7c2e
Author: Dan Davison <dandavison7@gmail.com>
Expand Down

0 comments on commit 91f1440

Please sign in to comment.