summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-12-26 23:39:21 +0000
committerDan Davison <dandavison7@gmail.com>2020-12-26 23:54:45 +0000
commit91f1440b868571309311887d8995f6e527d00966 (patch)
tree232e2d4ba1e9fe41e73ee48e39aaa0f08078a711
parent2b140ae8d2572377816b4b591a66e61d8f630c4b (diff)
Add failing test of hunk header with file and no frag
Ref #309
-rw-r--r--src/tests/test_example_diffs.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs
index 8049b01e..94b18f11 100644
--- a/src/tests/test_example_diffs.rs
+++ b/src/tests/test_example_diffs.rs
@@ -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]
@@ -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>