From 8cdb78bea3805c9ae6e80614a065b1a9d9d10d1d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Wed, 14 Oct 2026 19:51:17 -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/t0201-filters.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/t0201-filters.sh') diff --git a/tests/t0201-filters.sh b/tests/t0201-filters.sh index 3987bdc..6d33803 100755 --- a/tests/t0201-filters.sh +++ b/tests/t0201-filters.sh @@ -171,4 +171,27 @@ test_expect_success CGIT_LUA 'git can trace before the filters are set up' ' test -s trace2.out ' +# html_url_arg and html_include are the two calls a Lua filter has beyond +# plain html, and nothing else drives them. +test_expect_success CGIT_LUA 'a lua filter can encode an argument and include a file' ' + echo "included bold" >include.txt && + cat >apis.lua <<-EOF && + function filter_open(...) end + function filter_write(str) + html_url_arg("a b&c") + html("|") + html_include("$PWD/include.txt") + end + function filter_close() return 0 end + EOF + { + echo "cache-size=0" && + echo "repo.url=foo" && + echo "repo.path=$PWD/repos/foo/.git" && + echo "repo.commit-filter=lua:$PWD/apis.lua" + } >apisrc && + CGIT_CONFIG="$PWD/apisrc" QUERY_STRING="url=foo/commit" cgit >tmp && + grep "a+b%26c|included bold" tmp +' + test_done -- cgit 2.12.1