summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-12-27 22:03:22 +0000
committerDan Davison <dandavison7@gmail.com>2020-12-27 22:06:37 +0000
commit91f6707fb186279a505fdb69456d11dbf93870fd (patch)
tree17d8b8a819c23c0ee215f58706d9a179bed466ab
parent98782aa64e36298ca9fd76b36253ec3a931f7e98 (diff)
Add tests of hunk-header-style special attributes
-rw-r--r--src/tests/test_example_diffs.rs84
1 files changed, 84 insertions, 0 deletions
diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs
index 3530b29d..402a88a5 100644
--- a/src/tests/test_example_diffs.rs
+++ b/src/tests/test_example_diffs.rs
@@ -1172,6 +1172,36 @@ impl<'a> Alignment<'a> {
}
#[test]
+ fn test_hunk_header_style_box_line_number() {
+ _do_test_hunk_header_style_box(&[
+ "--hunk-header-style",
+ "line-number",
+ "--hunk-header-decoration-style",
+ "white box",
+ ]);
+ }
+
+ #[test]
+ fn test_hunk_header_style_box_file_line_number() {
+ _do_test_hunk_header_style_box_file_line_number(&[
+ "--hunk-header-style",
+ "file line-number",
+ "--hunk-header-decoration-style",
+ "white box",
+ ]);
+ }
+
+ #[test]
+ fn test_hunk_header_style_box_file() {
+ _do_test_hunk_header_style_box_file(&[
+ "--hunk-header-style",
+ "file",
+ "--hunk-header-decoration-style",
+ "white box",
+ ]);
+ }
+
+ #[test]
fn test_hunk_header_style_box_deprecated_options() {
_do_test_hunk_header_style_box(&["--hunk-color", "white", "--hunk-style", "box"]);
}
@@ -1203,6 +1233,60 @@ impl<'a> Alignment<'a> {
));
}
+ fn _do_test_hunk_header_style_box_file(args: &[&str]) {
+ let config = integration_test_utils::make_config_from_args(args);
+ let output = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, &config);
+ ansi_test_utils::assert_line_has_style(
+ &output,
+ 10,
+ "───────────────────────────────────────┐",
+ "white",
+ &config,
+ );
+ ansi_test_utils::assert_line_has_style(
+ &output,
+ 12,
+ "───────────────────────────────────────┘",
+ "white",
+ &config,
+ );
+ let output = strip_ansi_codes(&output);
+ assert!(output.contains(
+ "
+───────────────────────────────────────┐
+src/align.rs: impl<'a> Alignment<'a> { │
+───────────────────────────────────────┘
+"
+ ));
+ }
+
+ fn _do_test_hunk_header_style_box_file_line_number(args: &[&str]) {
+ let config = integration_test_utils::make_config_from_args(args);
+ let output = integration_test_utils::run_delta(GIT_DIFF_SINGLE_HUNK, &config);
+ ansi_test_utils::assert_line_has_style(
+ &output,
+ 10,
+ "──────────────────────────────────────────┐",
+ "white",
+ &config,
+ );
+ ansi_test_utils::assert_line_has_style(
+ &output,
+ 12,
+ "──────────────────────────────────────────┘",
+ "white",
+ &config,
+ );
+ let output = strip_ansi_codes(&output);
+ assert!(output.contains(
+ "
+──────────────────────────────────────────┐
+src/align.rs:71: impl<'a> Alignment<'a> { │
+──────────────────────────────────────────┘
+"
+ ));
+ }
+
#[test]
fn test_hunk_header_style_box_raw() {
let config = integration_test_utils::make_config_from_args(&[