Diff options
| -rwxr-xr-x | tests/t0101-index.sh | 40 |
1 file changed, 23 insertions, 17 deletions
diff --git a/tests/t0101-index.sh b/tests/t0101-index.sh index be947af..d269bdc 100755 --- a/tests/t0101-index.sh +++ b/tests/t0101-index.sh @@ -10,27 +10,32 @@ test_description='Check content on index page' . ./setup.sh -test_expect_success 'generate index page' 'cgit_url "" >tmp' +test_expect_success 'generate index page' 'cgit_ok_url "" >tmp' test_expect_success 'find foo repo' 'grep ">foo</a>" tmp' -test_expect_success 'find foo description' 'grep "\[no description\]" tmp' +test_expect_success 'find foo description' 'grep "href=./foo/.>\[no description\]</a>" tmp' test_expect_success 'find bar repo' 'grep ">bar</a>" 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 'no tree-link' '! grep "foo/tree" tmp' -test_expect_success 'no log-link' '! grep "foo/log" tmp' + +test_expect_success 'the index links no tree or log by default' ' + cgit_ok_url "" >tmp && + test_grep ">foo</a>" 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 links-cgitrc enable-index-links=1 && - cgit_rc links-cgitrc "url=" >tmp && - grep ">summary</a><a class=.button. href=./foo/log/.>log</a>" tmp && + cgitrc_copy linksrc enable-index-links=1 && + cgit_ok linksrc "url=" >tmp && + grep "<a class=.button. href=./foo/.>summary</a><a class=.button. href=./foo/log/.>log</a>" tmp && grep "href=./foo/log/.>log</a><a class=.button. href=./foo/tree/.>tree<" 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_rc headrc "url=" >tmp && + cgit_ok headrc "url=" >tmp && grep "<link rel=.stylesheet. href=./a.css.>" tmp && grep "<link rel=.stylesheet. href=./b.css.>" tmp && grep "<script src=" tmp >scripts && @@ -49,7 +54,7 @@ test_expect_success 'a cut description keeps whole characters' ' echo "repo.path=$PWD/repos/foo/.git" && echo "repo.desc=日本語の説明文です" } >descrc && - cgit_rc descrc "url=" >tmp && + cgit_ok descrc "url=" >tmp && grep ">日本語\.\.\.</a>" tmp ' @@ -82,12 +87,13 @@ test_expect_success 'the index sorts by a column on request' ' test_expect_success 'the sorted column heading says which way it runs' ' for s in name desc owner idle do - cgit_query "s=$s" >tmp && + cgit_ok_url "&s=$s" >tmp && grep "<th class=.left col-$s. scope=.col. aria-sort=.ascending.>" tmp && test $(grep -o "aria-sort" tmp | wc -l) = 1 || return 1 done && - cgit_url "" >tmp && - ! grep "aria-sort" tmp + cgit_ok_url "" >tmp && + test_grep "<th class=.left col-name. scope=.col.><a href=./?s=name.>Name</a></th>" tmp && + test_grep ! "aria-sort" tmp ' # A scan has no cgitrc order for the index to keep, so it lists what it finds @@ -107,11 +113,11 @@ test_expect_success 'a scan lists repositories in path order' ' echo "case-sensitive-sort=0" && cat sortrc } >foldrc && - cgit_rc sortrc "url=" >tmp && + cgit_ok sortrc "url=" >tmp && sed -n "s/.*>\([Pp]roj[0-9]\)\.git<\/a>.*/\1/p" tmp >order && printf "%s\n" Proj3 Proj5 proj1 proj2 proj4 proj6 proj7 proj8 proj9 >expect && test_cmp expect order && - cgit_rc foldrc "url=" >tmp && + cgit_ok foldrc "url=" >tmp && sed -n "s/.*>\([Pp]roj[0-9]\)\.git<\/a>.*/\1/p" tmp >order && printf "%s\n" proj1 proj2 Proj3 proj4 Proj5 proj6 proj7 proj8 proj9 >expect && test_cmp expect order @@ -134,12 +140,12 @@ test_expect_success 'a repository without repo.desc reads its description file' echo "repo.url=placeholder" && echo "repo.path=$PWD/repos/foo/.git" } >describedrc && - cgit_rc describedrc "url=" >tmp && + cgit_ok describedrc "url=" >tmp && grep "href=./described/.>told by the file</a>" tmp && grep "href=./overridden/.>from cgitrc</a>" tmp && grep "href=./placeholder/.>\[no description\]</a>" tmp && - ! grep "second line" tmp && - cgit_rc describedrc "url=described/" >tmp && + test_grep ! "second line" tmp && + cgit_ok describedrc "url=described/" >tmp && grep "<meta name=.description. content=.told by the file.>" tmp ' |
