From 94de70f5e46335383d63d2041e643ff3b61135a3 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 18:22:50 -1000 Subject: Test the index title and a repository's own name --- tests/t0005-markup.sh | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/t0005-markup.sh b/tests/t0005-markup.sh index e1da677..f5034f0 100755 --- a/tests/t0005-markup.sh +++ b/tests/t0005-markup.sh @@ -21,6 +21,7 @@ test_expect_success 'set up a repository with a file that has an extension' ' git add dir && git commit -m sources ) && + old=$(git -C repos/hooks rev-parse HEAD~1 | cut -c1-10) && cgitrc_repo hooksrc hooks enable-blame=1 max-stats=year readme=:file-1 \ "root-title=$site" ' @@ -127,7 +128,6 @@ test_expect_success 'each page names itself, then the repository and the site' ' # A commit the page is pinned to belongs with the page's own name, or with the # repository's on the summary, which has no name of its own. test_expect_success 'a pinned page names its commit before the repository' ' - old=$(git -C repos/hooks rev-parse HEAD~1 | cut -c1-10) && cgit_rc hooksrc "url=hooks/tree/&id=$old" >tmp && grep "tree @ $old - hooks - $site" tmp && cgit_rc hooksrc "url=hooks/commit/&id=$old" >tmp && @@ -136,6 +136,31 @@ test_expect_success 'a pinned page names its commit before the repository' ' grep "hooks @ $old - $site" tmp ' +test_expect_success 'the index is named after the site alone' ' + cgit_ok hooksrc "url=" >tmp && + test_grep "$site" tmp +' + +# A name set apart from the url is what the page shows wherever it names the +# repository, while data-repo keeps the url the README promises a theme. +test_expect_success 'a repository shows its name and keeps its url in data-repo' ' + { + cat hooksrc && + echo "repo.name=hook scripts" + } >namedrc && + cgit_ok namedrc "url=" >tmp && + test_grep "hook scripts" tmp && + cgit_ok namedrc "url=hooks/log/" >tmp && + test_grep "
" tmp && + test_grep "log - hook scripts - $site" tmp && + test_grep " : hook scripts" tmp && + cgit_ok namedrc "url=hooks/tree/&id=$old" >tmp && + test_grep "tree @ $old - hook scripts - $site" tmp && + cgit_rc namedrc "url=hooks/tree/missing" >tmp && + test_grep "^Status: 404" tmp && + test_grep "Not Found - hook scripts - $site" tmp +' + # The logo is all its link holds, so it is named after the site, both on the # default link to the index and on a link logo-link sends elsewhere. test_expect_success 'the logo is named after the site wherever it links' ' -- cgit 2.12.1