From ea618c5e257a6aabded76e63567ec0e7b99ac6c4 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Mon, 24 Aug 2026 16:21:18 -1000 Subject: Renumber the test scripts into themed ranges t000x the ground the suite stands on: git version, html validity, the cache t01xx page content, one script per page t02xx features that cut across pages: filters, submodule links, dates, limits t03xx defence, the security regressions and the $HOME promise t04xx the helper tools under tools/ --- tests/t0106-commit.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 tests/t0106-commit.sh (limited to 'tests/t0106-commit.sh') diff --git a/tests/t0106-commit.sh b/tests/t0106-commit.sh new file mode 100755 index 0000000..ca41830 --- /dev/null +++ b/tests/t0106-commit.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +# The commit page shows a single commit, its message, the files it touched and +# the diff for them. Most of these checks read the markup cgit emits for the +# tree link, the parent link, the subject and the diffstat. The last few ask +# for the root commit of a repository, which has no parent and so goes through +# the code that compares a commit against an empty tree. + +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 'find parent link' 'grep -E "" tmp' + +test_expect_success 'find commit subject' ' + grep "
commit 5<" tmp +' + +test_expect_success 'find commit msg' 'grep "
" tmp' +test_expect_success 'find diffstat' 'grep "" tmp' + +test_expect_success 'find diff summary' ' + grep "1 file changed, 1 insertion, 0 deletions" tmp +' + +test_expect_success 'get root commit' ' + root=$(cd repos/foo && git rev-list --reverse HEAD | head -1) && + 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 +' + +test_done -- cgit v2.8.0