From 1cd06726c50e7ffebef5339fe7128b4fce2b2d9b Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 18:31:09 -1000 Subject: Render each filter check in its own test A check read the tmp an earlier test had left, so run alone or after a failed fetch it read a stale page. Each test now asks for its own page through cgit_ok_url, which renders it past the shared cache and fails on a logged error or a page cut short. --- tests/t0201-filters.sh | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/tests/t0201-filters.sh b/tests/t0201-filters.sh index f9f1316..feacf31 100755 --- a/tests/t0201-filters.sh +++ b/tests/t0201-filters.sh @@ -14,41 +14,34 @@ do filter_prereq= test "$prefix" = exec || filter_prereq=CGIT_LUA - test_expect_success $filter_prereq "generate filter-$prefix/tree/a%2bb" " - cgit_url 'filter-$prefix/tree/a%2bb' >tmp - " - # Page output is buffered and has to be flushed as stdout is handed # to a filter and back. A missed flush reorders the page rather than # losing any of it, so the test below watches which side of the # filtered text the surrounding markup lands on. - test_expect_success $filter_prereq "check whether the $prefix source filter works" ' + test_expect_success $filter_prereq "the $prefix source filter gets the file name and fills the code cell" ' + cgit_ok_url "filter-$prefix/tree/a%2bb" >tmp && grep "a+b HELLO$" tmp && tr -d "\n" flat.out && grep "a+b HELLO" flat.out ' - test_expect_success $filter_prereq "generate filter-$prefix/about/" " - cgit_url 'filter-$prefix/about/' >tmp - " - - test_expect_success $filter_prereq "check whether the $prefix about filter works" ' - grep "
a+b /filter-$prefix/tree/ HELLO$" tmp + test_expect_success $filter_prereq "the $prefix about filter gets the readme name and the tree url" ' + cgit_ok_url "filter-$prefix/about/" >tmp && + grep "
a+b /filter-$prefix/tree/ HELLO$" tmp ' - test_expect_success $filter_prereq "generate filter-$prefix/commit/" " - cgit_url 'filter-$prefix/commit/' >tmp - " - - test_expect_success $filter_prereq "check whether the $prefix commit filter works" ' - grep "
ADD A+B" tmp + test_expect_success $filter_prereq "the $prefix commit filter rewrites the subject" ' + cgit_ok_url "filter-$prefix/commit/" >tmp && + grep "
ADD A+B" tmp ' - test_expect_success $filter_prereq "check whether the $prefix email filter works for authors" ' + test_expect_success $filter_prereq "the $prefix email filter gets the author's address and name" ' + cgit_ok_url "filter-$prefix/commit/" >tmp && grep " commit A U THOR <AUTHOR@EXAMPLE.COM>" tmp ' - test_expect_success $filter_prereq "check whether the $prefix email filter works for committers" ' + test_expect_success $filter_prereq "the $prefix email filter gets the committer's address and name" ' + cgit_ok_url "filter-$prefix/commit/" >tmp && grep " commit C O MITTER <COMMITTER@EXAMPLE.COM>" tmp ' done -- cgit 2.12.1