diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-12-19 12:35:17 +0000 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-12-19 12:48:25 +0000 |
commit | 3c31223dbfcbcb32c3c2da990091cc65e9f6eca1 (patch) | |
tree | ea823e3b3c517232a09a16dc8d7c932ae3aad0a8 | |
parent | 31066fc8803e47e5f992c53ab611e8077093693a (diff) |
Add failing test of hunk-header-style 'file' attribute
Ref #309
-rw-r--r-- | src/parse_style.rs | 2 | ||||
-rw-r--r-- | src/tests/test_example_diffs.rs | 21 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/parse_style.rs b/src/parse_style.rs index 565defa8..1fa4fb03 100644 --- a/src/parse_style.rs +++ b/src/parse_style.rs @@ -241,6 +241,8 @@ fn parse_ansi_term_style( style.is_strikethrough = true; } else if word == "ul" || word == "underline" { style.is_underline = true; + } else if word == "file" { + // Allow: this is meaningful in hunk-header-style. } else if !seen_foreground { if word == "syntax" { is_syntax_highlighted = true; diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs index f4121588..72c4c5f0 100644 --- a/src/tests/test_example_diffs.rs +++ b/src/tests/test_example_diffs.rs @@ -1009,6 +1009,27 @@ src/align.rs } #[test] + fn test_hunk_header_style_with_file() { + let config = integration_test_utils::make_config_from_args(&[ + "--file-style", + "yellow", + "--hunk-header-style", + "file red", + ]); + let output = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, &config); + + ansi_test_utils::assert_line_has_style( + &output, + 11, + "src/align.rs: impl<'a> Alignment<'a> {", + "yellow", + &config, + ); + let output = strip_ansi_codes(&output); + assert!(output.contains("src/align.rs: impl<'a> Alignment<'a> {")); + } + + #[test] fn test_commit_style_with_color_only_has_style() { let config = integration_test_utils::make_config_from_args(&[ "--color-only", |