diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
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.
Diffstat (limited to 'tests/t0201-filters.sh')
-rwxr-xr-xtests/t0201-filters.sh23
1 file changed, 23 insertions, 0 deletions
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 <b>bold</b>" >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 <b>bold</b>" tmp
+'
+
test_done