From 6eb6f0de8d369ea02298c32a93843bcd36c52087 Mon Sep 17 00:00:00 2001 From: Nigel Horne Date: Mon, 5 Oct 2020 10:15:13 -0400 Subject: [PATCH] Fail test if TMPDIR is not writable --- MANIFEST | 1 + Makefile.PL | 7 +++++++ t/eol.t | 20 ++++++++++++++++++++ t/js.t | 2 +- 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 t/eol.t diff --git a/MANIFEST b/MANIFEST index 41f4431..2b9f901 100644 --- a/MANIFEST +++ b/MANIFEST @@ -17,6 +17,7 @@ t/coverage.t t/critic.t t/cv.t t/dist.t +t/eol.t t/gv.t t/is_cached.t t/js.t diff --git a/Makefile.PL b/Makefile.PL index 831ad09..1ad8fb6 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,6 +1,13 @@ use strict; use warnings; use ExtUtils::MakeMaker 6.64; # 6.64 for TEST_REQUIRES +use File::Spec 3.4; + +my $tmpdir = File::Spec->tmpdir(); +if(!-w $tmpdir) { + print STDERR "NA: Your temporary directory '$tmpdir' isn't writable, fix your configuration and try again"; + exit(0); +} WriteMakefile( NAME => 'CGI::Buffer', diff --git a/t/eol.t b/t/eol.t new file mode 100644 index 0000000..3360315 --- /dev/null +++ b/t/eol.t @@ -0,0 +1,20 @@ +use strict; +use warnings; + +use Test::Most; + +BEGIN { + if($ENV{AUTHOR_TESTING}) { + eval { + require Test::EOL; + }; + if($@) { + plan(skip_all => 'Test::EOL not installed'); + } else { + import Test::EOL; + all_perl_files_ok({ trailing_whitespace => 1 }); + } + } else { + plan(skip_all => 'Author tests not required for installation'); + } +} diff --git a/t/js.t b/t/js.t index a689299..5f3cd39 100644 --- a/t/js.t +++ b/t/js.t @@ -26,7 +26,7 @@ OUTPUT: { use CGI::Buffer; CGI::Buffer::set_options(optimise_content => 2); - + print "Content-type: text/html; charset=ISO=8859-1"; print "\n\n";