History

Frame for testing tree(&tree) diffing

Sebastian Thiel committed 5 years ago

Commit 28c78f51 parent 9d038434 files · +64 −0Browse files

Showing the changes to git-diff (3 of 4 files). Show all

Unified · Split

3 files
  1. git-diff/Cargo.toml +3 −0
  2. git-diff/tests/diff.rs +12 −0
  3. git-diff/tests/fixtures/make_diff_repo.sh +48 −0
git-diff/Cargo.toml+3−0
@@ -14,3 +14,6 @@ doctest = false · 13 unmodified lines
14 14
15[dependencies]15[dependencies]
16git-object = { version = "0.7", path = "../git-object" }16git-object = { version = "0.7", path = "../git-object" }
17
18[dev-dependencies]
19test-tools = { path = "../tests/tools" }
git-diff/tests/diff.rs+12−0
@@ -0,0 +1,12 @@
1pub type Result = std::result::Result<(), Box<dyn std::error::Error>>;
2
3mod tree {
4 mod diff_tree {
5 #[test]
6 #[should_panic]
7 fn file_added() {
8 let _ = test_tools::scripted_fixture_repo_read_only("make_diff_repo.sh").unwrap();
9 todo!("detect an added file in the root tree")
10 }
11 }
12}
git-diff/tests/fixtures/make_diff_repo.sh+48−0
@@ -0,0 +1,48 @@
1#!/bin/bash
2set -eu -o pipefail
3
4git init -q
5git config commit.gpgsign false
6
7git checkout -q -b main
8
9touch f
10git add f
11git commit -qm 'f added'
12
13echo m > f
14git commit -qam 'f modified'
15
16rm f
17git commit -qam 'f deleted'
18
19echo m > f
20git add f
21git commit -qam 'f re-added same content'
22
23mv f f.tmp
24mkdir f
25mv f.tmp f/f
26git add f/
27git commit -qam 'f mode modified to dir f/'
28
29echo m >> f/f
30git commit -qam 'f/f modified'
31
32touch a
33git add a
34git commit -qam 'a added'
35
36touch f/a f/b
37git add f/
38git commit -qam 'f/a f/b added'
39
40rm f/f
41ln -s f/a f/f
42git commit -qam 'f/f mode changed to link'
43
44git mv a b
45git commit -qam 'a renamed to b'
46
47
48