diff options
author | root <root@rbsd.ankarstrom.se> | 2021-04-26 19:42:04 +0000 |
---|---|---|
committer | root <root@rbsd.ankarstrom.se> | 2021-04-26 19:42:04 +0000 |
commit | 020f1277ffc53225b7333c5339d7230281c0fb5a (patch) | |
tree | 2c2d81c051845dd1ec772459fd0a8e67e5c7e4bb /t | |
parent | dd107ea3d822f14f08198135ae2fc5b3b1d454b6 (diff) | |
download | Apache-Inject-020f1277ffc53225b7333c5339d7230281c0fb5a.tar.gz |
Remove test {head,foot}.html files, just create them when testing
This feels a bit cleaner and puts (most) everything in one place.
Diffstat (limited to 't')
-rw-r--r-- | t/basic.t | 27 | ||||
-rw-r--r-- | t/htdocs/foot.html | 2 | ||||
-rw-r--r-- | t/htdocs/head.html | 2 |
3 files changed, 15 insertions, 16 deletions
@@ -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'; diff --git a/t/htdocs/foot.html b/t/htdocs/foot.html deleted file mode 100644 index 77ef8be..0000000 --- a/t/htdocs/foot.html +++ /dev/null @@ -1,2 +0,0 @@ -<hr/> -<p>Copyright © Site Owner</p> diff --git a/t/htdocs/head.html b/t/htdocs/head.html deleted file mode 100644 index b4abf3f..0000000 --- a/t/htdocs/head.html +++ /dev/null @@ -1,2 +0,0 @@ -<h1>Site Header</h1> -<hr/> |