Skip Menu |

This queue is for tickets about the File-Map CPAN distribution.

Report information
The Basics
Id: 62861
Status: resolved
Priority: 0/
Queue: File-Map

People
Owner: Nobody in particular
Requestors: SEANM [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.31
Fixed in: (no value)



Subject: Test for expected exception when trying to localize file map fails
There is a test that expects to generate an exception when localizing a file map. The test is t/20-errors.t and the relevant part is: map_anonymous our $local, 1024; throws_ok { local $local } qr/^Can't localize file map at /, 'Localization throws an exception'; However, on Perl installations that don't have "local magic" the test actually exits normally. The output is: t/20-errors.t ..... 1/23 Writing directly to a memory mapped file is not recommended at t/20-errors.t line 69, <$self> line 1. # Failed test 'Localization throws an exception' # at t/20-errors.t line 69. # expecting: Regexp ((?-xism:^Can't localize file map at )) # found: normal exit # Looks like you failed 1 test of 23. I think the solution is to skip this test if local magic is not installed. I have provided a patch for review which uses Variable::Magic to determine whether to skip this test. patch -p1 < File-Map-0.31.patch
Subject: File-Map-0.31.patch
diff -Naur File-Map-0.31/Build.PL File-Map-0.31.fix/Build.PL --- File-Map-0.31/Build.PL 2010-09-21 01:15:08.000000000 +1000 +++ File-Map-0.31.fix/Build.PL 2010-11-09 15:46:51.000000000 +1100 @@ -19,6 +19,7 @@ 'Test::More' => 0, 'Test::Warn' => 0, 'Time::HiRes' => 0, + 'Variable::Magic' => 0, }, requires => { perl => 5.008, diff -Naur File-Map-0.31/t/20-errors.t File-Map-0.31.fix/t/20-errors.t --- File-Map-0.31/t/20-errors.t 2010-09-21 01:15:08.000000000 +1000 +++ File-Map-0.31.fix/t/20-errors.t 2010-11-09 15:47:12.000000000 +1100 @@ -5,6 +5,7 @@ use bytes; use File::Map qw/:map lock_map sync advise/; +use Variable::Magic qw/MGf_LOCAL/; use Test::More tests => 23; use Test::Warn; use Test::Exception; @@ -66,4 +67,7 @@ map_anonymous our $local, 1024; -throws_ok { local $local } qr/^Can't localize file map at /, 'Localization throws an exception'; +SKIP: { + skip 'No local magic for this perl', 1 unless (MGf_LOCAL); + throws_ok { local $local } qr/^Can't localize file map at /, 'Localization throws an exception'; +}
Hi Sean, Thanks for the report, I already noticed that bug and had a fix in my local git repo, but haven't released it yet because of real-life obligations. My fix is slightly different (I don't want to depend on Variable::Magic and I know exactly what version I need for this to work). I just released 0.32, which should fix this issue. Leon