aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;