diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Let a Lua script write while it loads
A script's top level runs before cgit hooks stdout for it, and the
unhook html() began with tripped an assert that aborted cgit.
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 1dd0910..c2d0ec4 100755 --- a/tests/t0201-filters.sh +++ b/tests/t0201-filters.sh @@ -130,4 +130,24 @@ test_expect_success CGIT_LUA 'a failing lua filter still renders an error page' grep "Lua error in" err ' +# A script runs its top level before cgit hooks stdout for it, so what it +# writes there goes straight onto the page instead of tripping the hook. +test_expect_success CGIT_LUA 'a lua filter that writes while loading still renders' ' + cat >loud.lua <<-\EOF && + html("written while loading") + function filter_open(...) end + function filter_write(str) html(str) 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/loud.lua" + } >loudrc && + CGIT_CONFIG="$PWD/loudrc" QUERY_STRING="url=foo/commit" cgit >tmp && + grep "written while loading" tmp && + grep "</html>" tmp +' + test_done |
