#!/bin/sh test_description='Check ci filter written in Lua' . ./setup.sh if test $CGIT_HAS_LUA -ne 1 then skip_all='Skipping Lua ci filter tests: Lua support not compiled in' test_done exit fi cat >cgitrc.cilua <ci-filter.lua <tmp && grep "^Location: https://ci.example.org/job/foo/job/v1.0$" tmp && echo "v1.0|tag|https://ci.example.org/job/foo/job/v1.0" >expected && test_cmp expected ci-filter.log ' test_expect_success 'Lua ci filter rejects a branch' ' cgit_ci "foo/ci&h=master" >tmp && grep "^Status: 404 Not found$" tmp ' test_expect_success 'Lua ci filter controls the tab' ' cgit_ci "foo/refs&h=v1.0" >tmp && grep "href=./foo/ci/?h=v1.0.>ci" tmp && cgit_ci "foo/refs&h=master" >tmp && ! grep ">ci" tmp ' test_expect_success 'page is still rendered correctly around the filter' ' cgit_ci "foo/refs&h=v1.0" >tmp && grep "" tmp && ! grep "|tag|" tmp ' test_done