summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2021-12-05 18:49:45 -0500
committerDan Davison <dandavison7@gmail.com>2021-12-05 19:27:40 -0500
commite7456d4e2884afa420b329d61a0c9b8dfc3f915a (patch)
tree6b684560d7faf42de3abe0670353852e332c7893
parent6f5090b7638aa8c9f88828a2e2631f6f5df84c8a (diff)
Failing test for #765
-rw-r--r--src/handlers/hunk_header.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/handlers/hunk_header.rs b/src/handlers/hunk_header.rs
index cf66e7bb..3ecb86c8 100644
--- a/src/handlers/hunk_header.rs
+++ b/src/handlers/hunk_header.rs
@@ -282,6 +282,7 @@ fn write_to_output_buffer(
#[cfg(test)]
pub mod tests {
use super::*;
+ use crate::ansi::strip_ansi_codes;
use crate::tests::integration_test_utils;
#[test]
@@ -409,4 +410,26 @@ pub mod tests {
assert_eq!(result, "");
}
+
+ #[test]
+ fn test_not_a_hunk_header_is_handled_gracefully() {
+ let config = integration_test_utils::make_config_from_args(&[]);
+ let output =
+ integration_test_utils::run_delta(GIT_LOG_OUTPUT_WITH_NOT_A_HUNK_HEADER, &config);
+ let output = strip_ansi_codes(&output);
+ assert!(output.contains("@@@2021-12-05"));
+ }
+
+ const GIT_LOG_OUTPUT_WITH_NOT_A_HUNK_HEADER: &str = "\
+@@@2021-12-05
+
+src/config.rs | 2 +-
+src/delta.rs | 3 ++-
+src/handlers/hunk.rs | 12 ++++++------
+src/handlers/hunk_header.rs | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------
+src/handlers/merge_conflict.rs | 2 +-
+src/handlers/submodule.rs | 4 ++--
+src/paint.rs | 2 +-
+7 files changed, 90 insertions(+), 54 deletions(-)
+";
}