aboutsummaryrefslogtreecommitdiff
path: root/t/basic.t
diff options
context:
space:
mode:
Diffstat (limited to 't/basic.t')
-rw-r--r--t/basic.t27
1 files changed, 15 insertions, 12 deletions
diff --git a/t/basic.t b/t/basic.t
index 231c491..8e5a37b 100644
--- a/t/basic.t
+++ b/t/basic.t
@@ -13,18 +13,6 @@ 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'
- or die "Could not open < t/htdocs/head.html: $!";
-open my $f, '<', 't/htdocs/foot.html'
- or die "Could not open < t/htdocs/foot.html: $!";
-$head = do { local $/; <$h> };
-$foot = do { local $/; <$f> };
-close $h; close $f;
-
# Helper for replacing file contents
sub overwrite {
@@ -36,6 +24,18 @@ sub overwrite {
# Run tests
+mkdir 't/htdocs/subdir' if ! -d 't/htdocs/subdir';
+
+$head = <<HEAD;
+This is a test header.
+HEAD
+overwrite 't/htdocs/head.html', $head;
+
+$foot = <<HEAD;
+This is a test footer.
+HEAD
+overwrite 't/htdocs/foot.html', $foot;
+
overwrite 't/htdocs/.htaccess', <<CONF;
Inject head.html foot.html
CONF
@@ -94,6 +94,9 @@ ok GET_BODY('/test.html'), "${body[0]}$head",
'only footer';
unlink 't/htdocs/.htaccess';
+unlink 't/htdocs/head.html';
+unlink 't/htdocs/foot.html';
unlink 't/htdocs/test.html';
unlink 't/htdocs/subdir/.htaccess';
unlink 't/htdocs/subdir/test.html';
+rmdir 't/htdocs/subdir';