From 4253ab2a152c39814551e3dd5fa35e5783b8e037 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 17 Oct 2026 12:53:19 -1000 Subject: Test the features the suite never reached Index sorting, the commit graph, the stats periods past a week, the hex dump of a binary file and a Lua filter's html_url_arg and html_include ran in no test. --- tests/t0101-index.sh | 13 +++++++++++++ tests/t0103-log.sh | 9 +++++++++ tests/t0104-tree.sh | 19 +++++++++++++++++++ tests/t0112-stats.sh | 11 +++++++++++ tests/t0201-filters.sh | 23 +++++++++++++++++++++++ 5 files changed, 75 insertions(+) (limited to 'tests') diff --git a/tests/t0101-index.sh b/tests/t0101-index.sh index e433beb..8d389b6 100755 --- a/tests/t0101-index.sh +++ b/tests/t0101-index.sh @@ -67,4 +67,17 @@ test_expect_success 'a cut description keeps whole characters' ' grep ">日本語\.\.\." tmp ' +# The index sorts by a column only when asked, which nothing else exercises. +test_expect_success 'the index sorts by a column on request' ' + cgit_query "s=name" >tmp && + bar=$(grep -n ">bar" tmp | head -1 | cut -d: -f1) && + foo=$(grep -n ">foo" tmp | head -1 | cut -d: -f1) && + test "$bar" -lt "$foo" && + for s in desc owner idle + do + cgit_query "s=$s" >tmp && + grep ">foo" tmp || return 1 + done +' + test_done diff --git a/tests/t0103-log.sh b/tests/t0103-log.sh index f9612e6..9671e7f 100755 --- a/tests/t0103-log.sh +++ b/tests/t0103-log.sh @@ -101,4 +101,13 @@ test_expect_success 'a cut subject keeps whole characters' ' grep ">日本語の説\.\.\." tmp ' +test_expect_success 'the log draws the commit graph when enabled' ' + { + echo "enable-commit-graph=1" && + sed "s/^cache-size=.*/cache-size=0/" cgitrc + } >graphrc && + CGIT_CONFIG="$PWD/graphrc" QUERY_STRING="url=foo/log/" cgit >tmp && + grep "class=.commitgraph." tmp +' + test_done diff --git a/tests/t0104-tree.sh b/tests/t0104-tree.sh index e92b2a2..b48c394 100755 --- a/tests/t0104-tree.sh +++ b/tests/t0104-tree.sh @@ -135,4 +135,23 @@ test_expect_success 'a long directory chain ends on a link' ' ! grep " / " tmp ' +test_expect_success 'a binary file in the tree shows as a hex dump' ' + test_create_repo repos/bin && + ( + cd repos/bin && + printf "\\000\\001\\002bin" >blob.bin && + git add blob.bin && + git commit -m binary + ) && + { + echo "virtual-root=/" && + echo "cache-size=0" && + echo "repo.url=bin" && + echo "repo.path=$PWD/repos/bin/.git" + } >binrc && + CGIT_CONFIG="$PWD/binrc" QUERY_STRING="url=bin/tree/blob.bin" cgit >tmp && + grep "" tmp && + grep "
0000 00 01 02 62 69 6e" tmp +' + test_done diff --git a/tests/t0112-stats.sh b/tests/t0112-stats.sh index 4d61e6c..7b08a6b 100755 --- a/tests/t0112-stats.sh +++ b/tests/t0112-stats.sh @@ -85,4 +85,15 @@ test_expect_success 'max-stats bounds the selectable periods' ' ! grep "