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
1414
1515 [dependencies]
1616 git-object = { version = "0.7", path = "../git-object" }
17+
18+[dev-dependencies]
19+test-tools = { path = "../tests/tools" }
git-diff/tests/diff.rs+12−0
@@ -0,0 +1,12 @@
1+pub type Result = std::result::Result<(), Box<dyn std::error::Error>>;
2+
3+mod 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
2+set -eu -o pipefail
3+
4+git init -q
5+git config commit.gpgsign false
6+
7+git checkout -q -b main
8+
9+touch f
10+git add f
11+git commit -qm 'f added'
12+
13+echo m > f
14+git commit -qam 'f modified'
15+
16+rm f
17+git commit -qam 'f deleted'
18+
19+echo m > f
20+git add f
21+git commit -qam 'f re-added same content'
22+
23+mv f f.tmp
24+mkdir f
25+mv f.tmp f/f
26+git add f/
27+git commit -qam 'f mode modified to dir f/'
28+
29+echo m >> f/f
30+git commit -qam 'f/f modified'
31+
32+touch a
33+git add a
34+git commit -qam 'a added'
35+
36+touch f/a f/b
37+git add f/
38+git commit -qam 'f/a f/b added'
39+
40+rm f/f
41+ln -s f/a f/f
42+git commit -qam 'f/f mode changed to link'
43+
44+git mv a b
45+git commit -qam 'a renamed to b'
46+
47+
48+