#!/bin/sh # The index page, one row per repository in cgitrc. The checks look for each # fixture repository and its description, for the escaping a name with a # plus or a space needs in a link, and for the absence of the tree and log # links that belong to a repository's own pages unless enable-index-links # asks for them. The page's head also stands in for every page's, with one # link per css and js entry. test_description='Check content on index page' . ./setup.sh test_expect_success 'generate index page' 'cgit_ok_url "" >tmp' test_expect_success 'find foo repo' 'grep ">foo" tmp' test_expect_success 'find foo description' 'grep "href=./foo/.>\[no description\]" tmp' test_expect_success 'find bar repo' 'grep ">bar" tmp' test_expect_success 'find bar description' 'grep "the bar repo" tmp' test_expect_success 'find foo+bar repo' 'grep ">foo+bar<" tmp' test_expect_success 'verify foo+bar links' 'test $(grep -o "href=./foo%2Bbar/." tmp | wc -l) = 2' test_expect_success 'verify "with%20space" links' 'test $(grep -o "href=./with%20space/." tmp | wc -l) = 2' test_expect_success 'the index links no tree or log by default' ' cgit_ok_url "" >tmp && test_grep ">foo" tmp && test_grep ! "foo/tree" tmp && test_grep ! "foo/log" tmp ' test_expect_success 'index links lead to the summary, log and tree' ' cgitrc_copy linksrc enable-index-links=1 && cgit_ok linksrc "url=" >tmp && grep "summarylog" tmp && grep "href=./foo/log/.>logtree<" tmp ' test_expect_success 'each css and js entry gets a link of its own' ' cgitrc_copy headrc css=/a.css css=/b.css js=/a.js js= js=/b.js && cgit_ok headrc "url=" >tmp && grep "" tmp && grep "" tmp && grep "