From e0778a8e6ec87b34077776a72f01f4d0305ae7e2 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 25 Apr 2021 17:55:02 +0000 Subject: Re-arrange tests --- t/basic.t | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/t/basic.t b/t/basic.t index 936f6c4..c607548 100644 --- a/t/basic.t +++ b/t/basic.t @@ -11,6 +11,8 @@ my $head; # expected page header my $foot; # expected page footer my @body; # sections of page body +mkdir 't/htdocs/subdir' if ! -d 't/htdocs/subdir'; + # Read contents of header and footer open my $h, '<', 't/htdocs/head.html' @@ -33,12 +35,17 @@ sub set { # Run tests set 't/htdocs/.htaccess', <Test\n", "This is a test page.\n"); @@ -51,6 +58,15 @@ set 't/htdocs/test.html', @body; ok GET_BODY('/test.html'), "${body[0]}$head${body[1]}$foot", '-ful head'; +set 't/htdocs/subdir/.htaccess', <\n", "This is a test page.\n", "\n"); set 't/htdocs/test.html', @body; ok GET_BODY('/test.html'), "${body[0]}$head${body[1]}$foot${body[2]}", @@ -66,19 +82,6 @@ set 't/htdocs/test.html', @body; ok GET_BODY('/test.html'), "${body[0]}$head${body[1]}$foot", ' with leading newline'; -@body = ("This is a test page.\n"); -set 't/htdocs/subdir/test.html', @body; -ok GET_BODY('/subdir/test.html'), "$head${body[0]}", - 'different injection in subdirectory'; - -set 't/htdocs/subdir/.htaccess', <