From c78b55cf8317123284a985f70418fd71417d4d1c Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 12:42:08 -1000 Subject: Hold the commit tests to a working page The commit requests passed on any answer short of a crash, and the root commit checks read a page another test wrote. The tree row was found by its href alone, never by the tree id it names. --- tests/t0106-commit.sh | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) (limited to 'tests/t0106-commit.sh') 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 "" 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 "tree
$tree" tmp +' test_expect_success 'find parent link' ' parent=$(git -C repos/foo rev-parse master~1) && test_grep "parent
$parent" 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 "" tmp + test_grep ! "
" 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 "" tmp -' - -test_expect_success 'root commit contains diffstat' ' - grep "file-1" tmp -' - -test_expect_success 'root commit contains diff' ' - grep ">diff --git a/file-1 b/file-1<" tmp && - grep "
+1
" tmp + cgit_ok_url "foo/commit&id=$root" >tmp && + test_grep "file-1" tmp && + test_grep ">diff --git a/file-1 b/file-1<" tmp && + test_grep "
+1
" 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 "
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' ' -- cgit 2.12.1