diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Cap and paginate the ref listings
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0201-limits.sh | 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 60 insertions, 0 deletions
diff --git a/tests/t0201-limits.sh b/tests/t0201-limits.sh new file mode 100755 index 0000000..e7f74c6 --- /dev/null +++ b/tests/t0201-limits.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +test_description='Check the ref listing limits' +. ./setup.sh + +# A repo with several branches and tags, and a config that pins a tiny limit. +test_expect_success 'set up limit fixtures' ' + mkrepo repos/limits 1 && + ( + cd repos/limits && + seq 1 60 >big.c && + printf "int x;\n" >small.c && + git add -A && + git commit -m sources && + seq 301 360 >big.c && + printf "int y;\n" >small.c && + git commit -am change && + for i in 1 2 3; do git branch branch-$i || exit 1; done && + for i in 1 2 3; do git tag tag-$i || exit 1; done + ) && + { + echo "virtual-root=/" && + echo "cache-size=0" && + echo "max-ref-count=2" && + echo "repo.url=limits" && + echo "repo.path=$PWD/repos/limits/.git" + } >limitrc +' + +limitq() { CGIT_CONFIG="$PWD/limitrc" QUERY_STRING="$1" cgit; } + +# --- The refs page caps each section and links to the category pages -------- +test_expect_success 'refs page lists max-ref-count branches and tags' ' + limitq "url=limits/refs/" >tmp && + test $(grep -c "log/?h=" tmp) -eq 2 && + test $(grep -c "/tag/?h=tag-" tmp) -eq 2 +' + +test_expect_success 'refs page links each overflow to its own category' ' + grep "refs/heads" tmp && + grep "refs/tags" tmp +' + +test_expect_success 'branch page paginates independently' ' + limitq "url=limits/refs/heads/" >tmp && + test $(grep -c "log/?h=" tmp) -eq 2 && + grep "\[next\]" tmp && + limitq "url=limits/refs/heads/&ofs=2" >tmp && + grep "\[prev\]" tmp && + ! grep "/tag/?h=tag-" tmp +' + +test_expect_success 'tag page paginates independently' ' + limitq "url=limits/refs/tags/&ofs=2" >tmp && + grep "/tag/?h=tag-" tmp && + grep "\[prev\]" tmp && + ! grep "log/?h=" tmp +' + +test_done |
