summaryrefslogtreecommitdiffstats
path: root/src/tests/test_example_diffs.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/test_example_diffs.rs')
-rw-r--r--src/tests/test_example_diffs.rs33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs
index 2eca792f..325f2e9a 100644
--- a/src/tests/test_example_diffs.rs
+++ b/src/tests/test_example_diffs.rs
@@ -17,7 +17,6 @@ mod tests {
}
#[test]
- #[ignore] // #128
fn test_added_empty_file() {
DeltaTest::with_args(&[])
.with_input(ADDED_EMPTY_FILE)
@@ -1571,6 +1570,21 @@ src/align.rs:71: impl<'a> Alignment<'a> { │
}
#[test]
+ fn test_file_deleted_without_preimage() {
+ DeltaTest::with_args(&[])
+ .with_input(GIT_DIFF_FILE_DELETED_WITHOUT_PREIMAGE)
+ .expect_contains("removed: foo.bar");
+ }
+
+ #[test]
+ fn test_files_deleted_without_preimage() {
+ DeltaTest::with_args(&[])
+ .with_input(GIT_DIFF_FILES_DELETED_WITHOUT_PREIMAGE)
+ .expect_contains("removed: foo")
+ .expect_contains("removed: bar");
+ }
+
+ #[test]
fn test_file_mode_change_with_diff() {
DeltaTest::with_args(&["--navigate", "--keep-plus-minus-markers"])
.with_input(GIT_DIFF_FILE_MODE_CHANGE_WITH_DIFF)
@@ -2334,6 +2348,23 @@ old mode 100700
new mode 100644
";
+ // This output can be generated with `git diff -D`
+ const GIT_DIFF_FILE_DELETED_WITHOUT_PREIMAGE: &str = "
+diff --git a/foo.bar b/foo.bar
+deleted file mode 100644
+index e019be0..0000000
+";
+
+ // This output can be generated with `git diff -D`
+ const GIT_DIFF_FILES_DELETED_WITHOUT_PREIMAGE: &str = "
+diff --git a/foo b/foo
+deleted file mode 100644
+index e019be0..0000000
+diff --git a/bar b/bar
+deleted file mode 100644
+index e019be0..0000000
+";
+
const GIT_DIFF_FILE_MODE_CHANGE_WITH_DIFF: &str = "
diff --git a/src/script b/src/script
old mode 100644