Diff options
Diffstat (limited to 'tests/t0106-commit.sh')
| -rwxr-xr-x | tests/t0106-commit.sh | 32 |
1 file changed, 14 insertions, 18 deletions
diff --git a/tests/t0106-commit.sh b/tests/t0106-commit.sh index 4cf361f..5ca89b0 100755 --- a/tests/t0106-commit.sh +++ b/tests/t0106-commit.sh @@ -6,8 +6,11 @@ test_description='Check content on commit page' . ./setup.sh -test_expect_success 'generate foo/commit' 'cgit_url "foo/commit" >tmp' -test_expect_success 'find tree link' 'grep "<a href=./foo/tree/.>" tmp' +test_expect_success 'generate foo/commit' 'cgit_ok_url "foo/commit" >tmp' +test_expect_success 'find tree link' ' + tree=$(git -C repos/foo rev-parse master^{tree}) && + test_grep "<th scope=.row.>tree</th><td colspan=.2. class=.oid.><div class=.spanning.><a href=./foo/tree/.>$tree</a>" tmp +' test_expect_success 'find parent link' ' parent=$(git -C repos/foo rev-parse master~1) && test_grep "<th scope=.row.>parent</th><td colspan=.2. class=.oid.><div class=.spanning.><a href=./foo/commit/?id=$parent.>$parent</a>" tmp @@ -35,25 +38,18 @@ test_expect_success 'a commit that changes no files draws no diffstat table' ' cd repos/foo && git update-ref refs/heads/empty $(git commit-tree HEAD^{tree} -p HEAD -m empty) ) && - cgit_url "foo/commit/&h=empty" >tmp && + cgit_ok_url "foo/commit/&h=empty" >tmp && grep "0 files changed, 0 insertions, 0 deletions" tmp && - ! grep "<table class=.diffstat.>" tmp + test_grep ! "<table class=.diffstat.>" tmp ' # A root commit has no parent, so it diffs against the empty tree. -test_expect_success 'get root commit' ' +test_expect_success 'a root commit diffs against the empty tree' ' root=$(git -C repos/foo rev-list --max-parents=0 HEAD) && - cgit_url "foo/commit&id=$root" >tmp && - grep "</html>" tmp -' - -test_expect_success 'root commit contains diffstat' ' - grep "<a href=./foo/diff/file-1.id=[0-9a-f]\{40,64\}.>file-1</a>" tmp -' - -test_expect_success 'root commit contains diff' ' - grep ">diff --git a/file-1 b/file-1<" tmp && - grep "<div class=.add.>+1</div>" tmp + cgit_ok_url "foo/commit&id=$root" >tmp && + test_grep "<a href=./foo/diff/file-1.id=$root.>file-1</a>" tmp && + test_grep ">diff --git a/file-1 b/file-1<" tmp && + test_grep "<div class=.add.>+1</div>" tmp ' # A message that is not UTF-8, because its encoding header names something @@ -69,10 +65,10 @@ test_expect_success 'a message that is not UTF-8 has its stray bytes replaced' ' cid=$(git hash-object --literally -t commit -w raw) && git update-ref refs/heads/latin "$cid" ) && - cgit_url "foo/commit&h=latin" >tmp && + cgit_ok_url "foo/commit&h=latin" >tmp && grep "<div class=.commit-subject.>caf? subject<" tmp && grep "body ? end" tmp && - ! grep "caf$(printf "\351")" tmp + test_grep ! "caf$(printf "\351")" tmp ' test_expect_success 'an octopus merge, which draws no diff, offers no diff options' ' |
