summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-11-20 20:25:35 -0500
committerDan Davison <dandavison7@gmail.com>2020-11-22 20:18:37 -0500
commitc6dd83575242348a4c8561ef898faa0a978fd39d (patch)
treecc0cc1429351e460fbb929453131115969d8badf
parentf52464c1af557a5759566a988d2478ccb6e86d3e (diff)
Add failing test of copied file diff
Ref #392
-rw-r--r--src/tests/test_example_diffs.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs
index 022748df..2bea133d 100644
--- a/src/tests/test_example_diffs.rs
+++ b/src/tests/test_example_diffs.rs
@@ -47,6 +47,17 @@ mod tests {
}
#[test]
+ fn test_copied_file() {
+ let config = integration_test_utils::make_config_from_args(&[]);
+ let output = integration_test_utils::run_delta(GIT_DIFF_WITH_COPIED_FILE, &config);
+ let output = strip_ansi_codes(&output);
+ assert!(test_utils::contains_once(
+ &output,
+ "\ncopied: first_file ⟶ copied_file\n"
+ ));
+ }
+
+ #[test]
fn test_renamed_file_with_changes() {
let config = integration_test_utils::make_config_from_args(&[]);
let output = integration_test_utils::run_delta(RENAMED_FILE_WITH_CHANGES_INPUT, &config);
@@ -1658,6 +1669,19 @@ index 0000000..b572921
Binary files /dev/null and b/foo differ
";
+ const GIT_DIFF_WITH_COPIED_FILE: &str = "
+commit f600ed5ced4d98295ffa97571ed240cd86c34ac6 (HEAD -> master)
+Author: Dan Davison <dandavison7@gmail.com>
+Date: Fri Nov 20 20:18:30 2020 -0500
+
+ copy
+
+diff --git a/first_file b/copied_file
+similarity index 100%
+copy from first_file
+copy to copied_file
+";
+
// git --no-pager show -p --cc --format= --numstat --stat
// #121
const DIFF_WITH_UNRECOGNIZED_PRECEDING_MATERIAL_1: &str = "