fix missinginclude tests 3.22_01
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 3 Jun 2008 03:35:27 +0000 (03:35 +0000)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 3 Jun 2008 03:42:39 +0000 (03:42 +0000)
Try to open the missing file in the same way PLP::source() will,
to obtain the same warning message.

For example MSWin32-x86-multi-thread said:
Can't open "C:\Perl\cpan\build\PLP-3.22-ZfVju5\missinginclude" (No such file or directory)
while several CPANTS linuxes were localized:
Can't open "/tmp/missinginclude" (Datei oder Verzeichnis nicht gefunden)

META.yml
lib/PLP.pm
t/50-cgi.t

index 84a832a1b261975b999b5a96697e8757c2c90e69..8b8595a8aff76b1d88331ae317cb4b779e6f35eb 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -1,7 +1,7 @@
 --- #YAML:1.0
 name: PLP
 abstract: Perl in HTML pages
-version: 3.22
+version: 3.22_01
 version_from: PLP.pm
 author:
     - Mischa POSLAWSKY <perl@shiar.org>
@@ -32,7 +32,7 @@ optional_features:
 provides:
     PLP:
         file: lib/PLP.pm
-        version: 3.22
+        version: 3.22_01
     PLP::Script:
         file: lib/PLP.pm
     PLP::Functions:
index 54a3b91fe5eb43248f81a9f4716478e1fd6f5e43..d17c9c631bdd7a01f3a1a2af51307a15065bab0a 100644 (file)
@@ -14,7 +14,7 @@ use File::Spec;
 use strict;
 use warnings;
 
-our $VERSION = '3.22';
+our $VERSION = '3.22_01';
 
 # Subs in this package:
 #  _default_error($plain, $html)    Default error handler
index cd10ee47381c916c4f7cf9fced66c13b0ca7d7ed..0de69407b3798b2ae275747195bf9cb8847bf6cf 100644 (file)
@@ -106,6 +106,15 @@ $HEAD
 </td></tr></table>
 TEST
 
+SKIP: {
+
+my $INCFILE = File::Spec->rel2abs("$base/missinginclude");
+if (open my $dummy, "<", $INCFILE) {  # like PLP::source will
+       fail("file missinginclude shouldn't exist");
+       skip("missinginclude tests", 2);
+}
+my $INCWARN = qq{Can't open "$INCFILE" ($!)};
+
 plp_is('warnings', split /\n\n/, <<TEST, 2);
 1
 <: use warnings :>
@@ -129,16 +138,16 @@ Useless use of a constant in void context at $testfile line 4.
 warning at $testfile line 6.
 
 4
-<table border=1 class="PLPerror"><tr><td><b>Debug information:</b><br>Can't open "$base/missinginclude" (No such file or directory) at $testfile line 8.
+<table border=1 class="PLPerror"><tr><td><b>Debug information:</b><br>$INCWARN at $testfile line 8.
 </td></tr></table>
 5
-<table border=1 class="PLPerror"><tr><td><b>Debug information:</b><br>Can't open "$base/missinginclude" (No such file or directory) at $testfile line 10.
+<table border=1 class="PLPerror"><tr><td><b>Debug information:</b><br>$INCWARN at $testfile line 10.
 </td></tr></table>
 TEST
 
 plp_is('$PLP::ERROR',
        '<: $PLP::ERROR = sub {print "Oh no: $_[0]"} :> <(missinginclude)>.',
-       qq{$HEAD\n Oh no: Can't open "$base/missinginclude" (No such file or directory) at $testfile line 1.\n\n}
+       qq{$HEAD\n Oh no: $INCWARN at $testfile line 1.\n\n}
 );
 
 #TODO: 404
@@ -149,6 +158,8 @@ plp_is('$PLP::DEBUG',
        "Content-Type: text/plain\n\nContent-Type: text/html\n\n1"
 );
 
+}
+
 plp_is('utf8', '<: use open qw/:std :utf8/; print chr 191', <<TEST);
 Content-Type: text/html; charset=utf-8
 X-PLP-Version: $PLP::VERSION