From dd107ea3d822f14f08198135ae2fc5b3b1d454b6 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 26 Apr 2021 19:33:46 +0000 Subject: Fix regex bug, support HTML comments I added \s* after to match any potential newline (and, for good measure, whitespace) after . One would usually rather have this: My header than this: My header --- t/basic.t | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 't') diff --git a/t/basic.t b/t/basic.t index f81c661..231c491 100644 --- a/t/basic.t +++ b/t/basic.t @@ -5,7 +5,7 @@ use Apache::Test; use Apache::TestUtil; use Apache::TestRequest qw/GET_BODY/; -BEGIN { plan tests => 7; } +BEGIN { plan tests => 9; } # Prepare environment @@ -50,15 +50,6 @@ overwrite 't/htdocs/test.html', @body; ok GET_BODY('/test.html'), "${body[0]}$head${body[1]}$foot", '-ful head'; -overwrite 't/htdocs/subdir/.htaccess', <\n", "This is a test page.\n", "\n"); overwrite 't/htdocs/test.html', @body; ok GET_BODY('/test.html'), "${body[0]}$head${body[1]}$foot${body[2]}", @@ -74,6 +65,25 @@ overwrite 't/htdocs/test.html', @body; ok GET_BODY('/test.html'), "${body[0]}$head${body[1]}$foot", ' with leading newline'; +@body = ("\n\n", "This is a test page.\n"); +overwrite 't/htdocs/test.html', @body; +ok GET_BODY('/test.html'), "${body[0]}$head${body[1]}$foot", + 'comments in '; + +@body = ("\n", "This is a test page.\n"); +overwrite 't/htdocs/test.html', @body; +ok GET_BODY('/test.html'), "${body[0]}$head${body[1]}$foot", + 'document with '; + +overwrite 't/htdocs/subdir/.htaccess', <