From 91f1440b868571309311887d8995f6e527d00966 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sat, 26 Dec 2020 23:39:21 +0000 Subject: Add failing test of hunk header with file and no frag Ref #309 --- src/tests/test_example_diffs.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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 -- cgit v1.2.3