From 72c681d3a16a706b0a3dd2b6dda95edcb4f78f51 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 24 Apr 2021 00:56:05 +0000 Subject: Add Makefile, basic test --- t/SMOKE | 21 +++++++++++++++++++++ t/TEST.PL | 10 ++++++++++ t/basic.t | 21 +++++++++++++++++++++ t/conf/extra.conf.in | 1 + t/conf/extra.last.conf.in | 4 ++++ t/htdocs/foot.html | 2 ++ t/htdocs/head.html | 2 ++ 7 files changed, 61 insertions(+) create mode 100755 t/SMOKE create mode 100644 t/TEST.PL create mode 100644 t/basic.t create mode 100644 t/conf/extra.conf.in create mode 100644 t/conf/extra.last.conf.in create mode 100644 t/htdocs/foot.html create mode 100644 t/htdocs/head.html (limited to 't') diff --git a/t/SMOKE b/t/SMOKE new file mode 100755 index 0000000..7b1d937 --- /dev/null +++ b/t/SMOKE @@ -0,0 +1,21 @@ +#!/usr/local/bin/perl +# WARNING: this file is generated, do not edit +# generated on Sat Apr 24 00:40:18 2021 +# 01: /usr/local/lib/perl5/site_perl/mach/5.32/Apache/TestConfig.pm:1003 +# 02: /usr/local/lib/perl5/site_perl/mach/5.32/Apache/TestConfig.pm:1095 +# 03: /usr/local/lib/perl5/site_perl/mach/5.32/Apache/TestSmoke.pm:775 +# 04: /usr/local/lib/perl5/site_perl/mach/5.32/Apache/TestMM.pm:143 +# 05: Makefile.PL:12 + +BEGIN { eval { require blib && blib->import; } } + +use strict; +use warnings FATAL => 'all'; + +use lib qw( + /root/prj/Apache-Inject +); + + +use Apache::TestSmoke; +Apache::TestSmoke->new(@ARGV)->run; \ No newline at end of file diff --git a/t/TEST.PL b/t/TEST.PL new file mode 100644 index 0000000..6c1c41c --- /dev/null +++ b/t/TEST.PL @@ -0,0 +1,10 @@ +#!perl + +use strict; +use warnings FATAL => 'all'; + +use lib qw(lib); + +use Apache::TestRunPerl (); + +Apache::TestRunPerl->new->run(@ARGV); diff --git a/t/basic.t b/t/basic.t new file mode 100644 index 0000000..f6e289f --- /dev/null +++ b/t/basic.t @@ -0,0 +1,21 @@ +use strict; +use warnings FATAL => 'all'; + +use Apache::Test; +use Apache::TestUtil; +use Apache::TestRequest qw/GET_BODY/; + +plan tests => 2; + +ok 1; + +open my $t, '<', 't/htdocs/test.html' or die; +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; + +my $body = GET_BODY '/test.html'; +ok $body, "$head$test$foot", 'Body of test.html includes header and footer'; diff --git a/t/conf/extra.conf.in b/t/conf/extra.conf.in new file mode 100644 index 0000000..fe9de1d --- /dev/null +++ b/t/conf/extra.conf.in @@ -0,0 +1 @@ +PerlSwitches -I@ServerRoot@/../lib diff --git a/t/conf/extra.last.conf.in b/t/conf/extra.last.conf.in new file mode 100644 index 0000000..0156023 --- /dev/null +++ b/t/conf/extra.last.conf.in @@ -0,0 +1,4 @@ +PerlLoadModule Apache::Inject + + Inject head.html foot.html + diff --git a/t/htdocs/foot.html b/t/htdocs/foot.html new file mode 100644 index 0000000..77ef8be --- /dev/null +++ b/t/htdocs/foot.html @@ -0,0 +1,2 @@ +
+

Copyright © Site Owner

diff --git a/t/htdocs/head.html b/t/htdocs/head.html new file mode 100644 index 0000000..b4abf3f --- /dev/null +++ b/t/htdocs/head.html @@ -0,0 +1,2 @@ +

Site Header

+
-- cgit v1.2.3