diff options
author | root <root@rbsd.ankarstrom.se> | 2021-04-24 01:11:23 +0000 |
---|---|---|
committer | root <root@rbsd.ankarstrom.se> | 2021-04-24 01:11:23 +0000 |
commit | e4f920da810a263e8bae849b3c36c47caf4cdd40 (patch) | |
tree | da7e524fa8ac2368b3343c90df1bd2c180fe09ac /t/basic.t | |
parent | 72c681d3a16a706b0a3dd2b6dda95edcb4f78f51 (diff) | |
download | Apache-Inject-e4f920da810a263e8bae849b3c36c47caf4cdd40.tar.gz |
Rewrite test
Diffstat (limited to 't/basic.t')
-rw-r--r-- | t/basic.t | 36 |
1 files changed, 27 insertions, 9 deletions
@@ -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; |