Diff options
Diffstat (limited to 'tests/t0107-diff.sh')
-rwxr-xr-xtests/t0107-diff.sh18
1 file changed, 4 insertions, 14 deletions
diff --git a/tests/t0107-diff.sh b/tests/t0107-diff.sh
index 96e37f5..6710cec 100755
--- a/tests/t0107-diff.sh
+++ b/tests/t0107-diff.sh
@@ -46,18 +46,13 @@ test_expect_success 'set up a repo with single-line hunks' '
printf "ONLY\n" >one.txt &&
git commit -am "change one.txt"
) &&
- {
- echo "virtual-root=/" &&
- echo "cache-size=0" &&
- echo "repo.url=hunk1" &&
- echo "repo.path=$PWD/repos/hunk1/.git"
- } >hunk1rc &&
+ cgitrc_repo hunk1rc hunk1 &&
git -C repos/hunk1 diff HEAD~1 HEAD >raw.diff &&
grep "^@@ -1 +1 @@" raw.diff
'
test_expect_success 'ssdiff numbers a comma-less hunk from its real line' '
- CGIT_CONFIG="$PWD/hunk1rc" QUERY_STRING="url=hunk1/diff/&dt=1" cgit >tmp &&
+ cgit_rc hunk1rc "url=hunk1/diff/&dt=1" >tmp &&
grep "#n1.>1</a>" tmp &&
! grep "#n0.>0</a>" tmp
'
@@ -85,16 +80,11 @@ test_expect_success 'set up a repo with shrinking changed lines' '
s=s sprintf(\"%c\",c)} print s}}" >lines.txt &&
git commit -am "change every line"
) &&
- {
- echo "virtual-root=/" &&
- echo "cache-size=0" &&
- echo "repo.url=lcs" &&
- echo "repo.path=$PWD/repos/lcs/.git"
- } >lcsrc
+ cgitrc_repo lcsrc lcs
'
test_expect_success 'every changed pair gets both a del and an add span' '
- CGIT_CONFIG="$PWD/lcsrc" QUERY_STRING="url=lcs/diff/&dt=1" cgit >tmp &&
+ cgit_rc lcsrc "url=lcs/diff/&dt=1" >tmp &&
deletions=$(grep -o "<span class=.del.>" tmp | wc -l) &&
additions=$(grep -o "<span class=.add.>" tmp | wc -l) &&
test "$deletions" -gt 0 &&