aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@rbsd.ankarstrom.se>2021-04-24 01:11:23 +0000
committerroot <root@rbsd.ankarstrom.se>2021-04-24 01:11:23 +0000
commite4f920da810a263e8bae849b3c36c47caf4cdd40 (patch)
treeda7e524fa8ac2368b3343c90df1bd2c180fe09ac
parent72c681d3a16a706b0a3dd2b6dda95edcb4f78f51 (diff)
downloadApache-Inject-e4f920da810a263e8bae849b3c36c47caf4cdd40.tar.gz
Rewrite test
-rw-r--r--t/basic.t36
1 files changed, 27 insertions, 9 deletions
diff --git a/t/basic.t b/t/basic.t
index f6e289f..0494ff0 100644
--- a/t/basic.t
+++ b/t/basic.t
@@ -5,17 +5,35 @@ use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest qw/GET_BODY/;
-plan tests => 2;
+plan tests => 1;
-ok 1;
+# (0) Prepare environment
-open my $t, '<', 't/htdocs/test.html' or die;
+# - Read contents of header and footer
open my $h, '<', 't/htdocs/head.html' or die;
open my $f, '<', 't/htdocs/foot.html' or die;
-my $test = do { local $/; <$t> };
-my $head = do { local $/; <$h> };
-my $foot = do { local $/; <$f> };
-close $t; close $h; close $f;
+chomp(my $head = do { local $/; <$h> });
+chomp(my $foot = do { local $/; <$f> });
+close $h; close $f;
-my $body = GET_BODY '/test.html';
-ok $body, "$head$test$foot", 'Body of test.html includes header and footer';
+# - Open test file for writing
+open my $t, '>', 't/htdocs/test.html' or die;
+my $test;
+
+# (1) <head>-less head
+
+$test = <<END;
+<title>Test</title>
+This is a test page.
+END
+seek($t, 0, 0);
+print $t $test;
+
+ok GET_BODY('/test.html'), <<END, '<head>-less head';
+<title>Test</title>
+$head
+This is a test page.
+$foot
+END
+
+close $t;