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/tests (2 of 4 files). Show all

Unified · Split

2 files
  1. git-diff/tests/diff.rs +12 −0
  2. git-diff/tests/fixtures/make_diff_repo.sh +48 −0
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+

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t