From a5b987a7399089de30f2223402d70d528e3b845c Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 18:24:58 -1000 Subject: Check every markup hook the README names The README promised that t0005 checked them all, while fourteen went unchecked, and three of its claims were too broad. A date shown in full carries no age hooks, line anchors follow enable-tree-linenumbers and cgit.css also styles html.cgit-standalone. --- tests/t0005-markup.sh | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) (limited to 'tests/t0005-markup.sh') diff --git a/tests/t0005-markup.sh b/tests/t0005-markup.sh index 2a8d572..bbf78b1 100755 --- a/tests/t0005-markup.sh +++ b/tests/t0005-markup.sh @@ -96,4 +96,77 @@ test_expect_success 'the stylesheet and the script name only the current hooks' grep "window.cgit.highlightLines" "$TEST_OUTPUT_DIRECTORY/../assets/cgit.js" ' +# The rest of the hooks need a tag, a symlink, a submodule, a trailer, clone +# urls and a second page of repositories, so they get a commit and a config +# of their own after the checks above have read the first ones. +test_expect_success 'set up the remaining kinds of entry' ' + ( + cd repos/hooks && + git tag -a -m "first release" v1 && + test_ln_s_add file-1 link && + git update-index --add --cacheinfo "160000,$(git rev-parse HEAD),sub" && + git commit -m "more kinds of entry" -m "Fixes: $(git rev-parse --short HEAD)" + ) && + { + echo "virtual-root=/" && + echo "cache-size=0" && + echo "enable-commit-trailers=1" && + echo "max-repo-count=1" && + echo "clone-url=https://example.com/clone.git" && + echo "repo.url=hooks" && + echo "repo.path=$PWD/repos/hooks/.git" && + echo "repo.url=again" && + echo "repo.path=$PWD/repos/hooks/.git" + } >morerc +' + +more() { CGIT_CONFIG="$PWD/morerc" QUERY_STRING="url=$1" cgit; } + +test_expect_success 'the refs, summary and tree name every section and row' ' + more "hooks/refs/" >tmp && + grep "" tmp && + grep "" tmp && + grep "" tmp && + more "hooks/" >tmp && + grep "" tmp && + more "hooks/tree/" >tmp && + grep "" tmp && + grep "" tmp && + grep "" tmp +' + +test_expect_success 'the commit page has its trailer table and diffstat' ' + more "hooks/commit/" >tmp && + grep "
" tmp && + grep "
" tmp +' + +test_expect_success 'the breadcrumb, the pager and the ages carry their hooks' ' + more "hooks/tree/dir/" >tmp && + grep "