Diff options
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0201-filters.sh | 20 |
1 file changed, 20 insertions, 0 deletions
diff --git a/tests/t0201-filters.sh b/tests/t0201-filters.sh index 8d8743a..4b39f18 100755 --- a/tests/t0201-filters.sh +++ b/tests/t0201-filters.sh @@ -168,4 +168,24 @@ test_expect_success CGIT_LUA 'a lua filter can encode an argument and include a grep "a+b%26c|included <b>bold</b>" tmp ' +# The print of LuaJIT and Lua 5.1 leaves its line in stdio's buffer, which only +# reached the page as cgit exited, behind the closing tag. A print lands where +# the filter runs. +test_expect_success CGIT_LUA 'a lua filter prints where it runs' ' + cat >print.lua <<-\EOF && + function filter_open(...) end + function filter_write(str) + print("printed", 1, nil, true) + html(str) + end + function filter_close() return 0 end + EOF + sed "s|loud.lua|print.lua|" loudrc >printrc && + cgit_rc printrc "url=foo/commit" >tmp && + tab=$(printf "\t") && + grep "<div class=.commit-subject.>printed${tab}1${tab}nil${tab}true$" tmp && + sed -n "/<\/html>/,\$p" tmp >tail && + ! grep printed tail +' + test_done |
