diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2014-12-27 16:19:50 +0000 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2014-12-27 16:19:50 +0000 |
commit | ebf27bc85d964536463e823bbdbdb42456bdbf70 (patch) | |
tree | df748b76442e06d06eaf591a3b7f332ce4456cc5 /cpan/autodie/t | |
parent | 2f8e48da71dd5ea1aea7cd8774500f3b82cd406c (diff) | |
download | perl-ebf27bc85d964536463e823bbdbdb42456bdbf70.tar.gz |
Update autodie to CPAN version 2.26
[DELTA]
2.26 2014-12-26 16:27:23+00:00 UTC
* BUGFIX / INCOMPAT: Remove "fileno" and "umask" from the list of
CORE subs protected by autodie and Fatal.
When they return undef, it is not a failure.
* BUGFIX: Fixed an error that could occur during global destruction of
the form "(in cleanup) Can't use an undefined value as an ARRAY
reference at .../autodie/Scope/GuardStack.pm line 48 during global
destruction" (Thanks to Dave Rolsky).
* BUGFIX: The open-pragma is now properly ignored when open is
given an explicit layer. This brings autodie protected
open in sync with open. Thanks to Gregory Oschwald and
Graham Knop for the report + test case and the patch.
(GH#52 + GH#53)
* BUGFIX: Hide the "SCALAR" (buffer) argument in the string
representation of autodie::exception for the read,
sysread and syswrite CORE subs. This is to avoid
a dump of binary data to the screen/log when a
(sys)read or syswrite fails.
* FEATURE: Let autodie::exception work in equality tests and
string comparison via "overload fallback".
(Thanks to Michael G. Schwern)
* DOC: Mention that "kill" is in the ":ipc" category. It has
been there since autodie v2.14.
(Thanks to Felipe Gasper for reporting it, RT#97320).
* INTERNAL: Use "parent" instead of "base" for inheritance. Also
avoid some @ISA relationships that were redundant.
Either truly redundant ones or by importing "import"
from Exporter v5.57.
- This change implies that perl 5.8 users must now
also fetch "parent" from cpan.
(Thanks to Olivier Mengué, GH#59)
* DEVEL / TEST: The autodie module now accepts an undefined Fatal
version, assuming it to be development version.
Test cases that require versions are now either
skipped or considered "release" test.
* TEST / INTERNAL: Enabled travis-ci for Perl 5.20
* TEST: Close temp file before re-opening in t/truncate.t.
(Thanks to Craig A. Berry, RT#96609)
* TEST: Pass O_TRUNC with O_CREAT to sysopen in t/utf8_open.t.
(Thanks to Craig A. Berry, RT#87237)
* TEST: Clean up temp file in t/truncate.t.
(Thanks to Dave Mitchell, RT#100688)
Diffstat (limited to 'cpan/autodie/t')
24 files changed, 124 insertions, 25 deletions
diff --git a/cpan/autodie/t/autodie_skippy.pm b/cpan/autodie/t/autodie_skippy.pm index 3baa9b571e..804e52fdca 100644 --- a/cpan/autodie/t/autodie_skippy.pm +++ b/cpan/autodie/t/autodie_skippy.pm @@ -2,7 +2,7 @@ package autodie_skippy; use strict; use warnings; use autodie; -use base qw(autodie::skip); +use parent qw(autodie::skip); # This should skip upwards to the caller. diff --git a/cpan/autodie/t/exceptions.t b/cpan/autodie/t/exceptions.t index 123cf8e883..4e7545d1ee 100644 --- a/cpan/autodie/t/exceptions.t +++ b/cpan/autodie/t/exceptions.t @@ -44,3 +44,5 @@ ok($@ ~~ ':file', "Exception from close / class :file" ); ok($@ ~~ ':io', "Exception from close / class :io" ); ok($@ ~~ ':all', "Exception from close / class :all" ); +ok $@ eq $@.'', "string overloading is complete (eq)"; +ok( ($@ cmp $@.'') == 0, "string overloading is complete (cmp)" ); diff --git a/cpan/autodie/t/import-into.t b/cpan/autodie/t/import-into.t new file mode 100644 index 0000000000..a7289dc468 --- /dev/null +++ b/cpan/autodie/t/import-into.t @@ -0,0 +1,26 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More; + +BEGIN { + eval 'use Import::Into'; + plan skip_all => 'Test needs Import::Into' if $@; +} + +use FindBin; +use lib "$FindBin::Bin/lib"; + +use my::pragma qw(open); + +plan tests => 1; + +my::pragma->dont_die(); + +eval { + open(my $fd, '<', 'random-file'); +}; +ok($@, 'my::pragma can use import::into'); + diff --git a/cpan/autodie/t/internal.t b/cpan/autodie/t/internal.t index c1189444cb..3853044107 100644 --- a/cpan/autodie/t/internal.t +++ b/cpan/autodie/t/internal.t @@ -1,9 +1,11 @@ #!/usr/bin/perl -w use strict; +use Scalar::Util qw(blessed); + use constant NO_SUCH_FILE => "this_file_or_dir_had_better_not_exist_XYZZY"; -use Test::More tests => 6; +use Test::More tests => 9; # Lexical tests using the internal interface. @@ -17,13 +19,28 @@ like($@, qr{:lexical must be used as first}, ":lexical must come first"); use Fatal qw(:lexical chdir); eval { chdir(NO_SUCH_FILE); }; - like ($@, qr/^Can't chdir/, "Lexical fatal chdir"); - - no Fatal qw(:lexical chdir); + my $err = $@; + like ($err, qr/^Can't chdir/, "Lexical fatal chdir"); + TODO: { + local $TODO = 'Fatal should not (but does) throw autodie::exceptions'; + is(blessed($err), undef, + "Fatal does not throw autodie::exceptions"); + } + + { + no Fatal qw(:lexical chdir); + eval { chdir(NO_SUCH_FILE); }; + is ($@, "", "No lexical fatal chdir"); + } eval { chdir(NO_SUCH_FILE); }; - is ($@, "", "No lexical fatal chdir"); - + $err = $@; + like ($err, qr/^Can't chdir/, "Lexical fatal chdir returns"); + TODO: { + local $TODO = 'Fatal should not (but does) throw autodie::exceptions'; + is(blessed($err), undef, + "Fatal does not throw autodie::exceptions"); + } } eval { chdir(NO_SUCH_FILE); }; diff --git a/cpan/autodie/t/lib/Hints_pod_examples.pm b/cpan/autodie/t/lib/Hints_pod_examples.pm index d88d98e106..05db908e18 100644 --- a/cpan/autodie/t/lib/Hints_pod_examples.pm +++ b/cpan/autodie/t/lib/Hints_pod_examples.pm @@ -2,7 +2,7 @@ package Hints_pod_examples; use strict; use warnings; -use base qw(Exporter); +use Exporter 5.57 'import'; our %DOES = ( 'autodie::hints::provider' => 1 ); diff --git a/cpan/autodie/t/lib/Hints_provider_does.pm b/cpan/autodie/t/lib/Hints_provider_does.pm index 403e4b49f7..688ca1e568 100644 --- a/cpan/autodie/t/lib/Hints_provider_does.pm +++ b/cpan/autodie/t/lib/Hints_provider_does.pm @@ -1,7 +1,7 @@ package Hints_provider_does; use strict; use warnings; -use base qw(Exporter); +use Exporter 5.57 'import'; our @EXPORT_OK = qw(always_fail always_pass no_hints); diff --git a/cpan/autodie/t/lib/Hints_provider_easy_does_it.pm b/cpan/autodie/t/lib/Hints_provider_easy_does_it.pm index 27dbcb2425..6f9d8a5448 100644 --- a/cpan/autodie/t/lib/Hints_provider_easy_does_it.pm +++ b/cpan/autodie/t/lib/Hints_provider_easy_does_it.pm @@ -1,7 +1,7 @@ package Hints_provider_easy_does_it; use strict; use warnings; -use base qw(Exporter); +use Exporter 5.57 'import'; our @EXPORT_OK = qw(always_fail always_pass no_hints); diff --git a/cpan/autodie/t/lib/Hints_provider_isa.pm b/cpan/autodie/t/lib/Hints_provider_isa.pm index ad15e3b258..695b6db2f3 100644 --- a/cpan/autodie/t/lib/Hints_provider_isa.pm +++ b/cpan/autodie/t/lib/Hints_provider_isa.pm @@ -1,7 +1,7 @@ package Hints_provider_isa; use strict; use warnings; -use base qw(Exporter); +use Exporter 5.57 'import'; our @EXPORT_OK = qw(always_fail always_pass no_hints); diff --git a/cpan/autodie/t/lib/Hints_test.pm b/cpan/autodie/t/lib/Hints_test.pm index 40107880cd..7dd189b799 100644 --- a/cpan/autodie/t/lib/Hints_test.pm +++ b/cpan/autodie/t/lib/Hints_test.pm @@ -2,7 +2,7 @@ package Hints_test; use strict; use warnings; -use base qw(Exporter); +use Exporter 5.57 'import'; our @EXPORT_OK = qw( fail_on_empty fail_on_false fail_on_undef diff --git a/cpan/autodie/t/lib/Some/Module.pm b/cpan/autodie/t/lib/Some/Module.pm index a24ec93f66..85bb844718 100644 --- a/cpan/autodie/t/lib/Some/Module.pm +++ b/cpan/autodie/t/lib/Some/Module.pm @@ -1,7 +1,7 @@ package Some::Module; use strict; use warnings; -use base qw(Exporter); +use Exporter 5.57 'import'; our @EXPORT_OK = qw(some_sub); diff --git a/cpan/autodie/t/lib/autodie/test/au.pm b/cpan/autodie/t/lib/autodie/test/au.pm index 7a50e8f101..fca789b270 100644 --- a/cpan/autodie/t/lib/autodie/test/au.pm +++ b/cpan/autodie/t/lib/autodie/test/au.pm @@ -2,7 +2,7 @@ package autodie::test::au; use strict; use warnings; -use base qw(autodie); +use parent qw(autodie); use autodie::test::au::exception; diff --git a/cpan/autodie/t/lib/autodie/test/au/exception.pm b/cpan/autodie/t/lib/autodie/test/au/exception.pm index 5811fc1ea6..0c0efec1f7 100644 --- a/cpan/autodie/t/lib/autodie/test/au/exception.pm +++ b/cpan/autodie/t/lib/autodie/test/au/exception.pm @@ -2,7 +2,7 @@ package autodie::test::au::exception; use strict; use warnings; -use base qw(autodie::exception); +use parent qw(autodie::exception); sub time_for_a_beer { return "Now's a good time for a beer."; diff --git a/cpan/autodie/t/lib/autodie/test/badname.pm b/cpan/autodie/t/lib/autodie/test/badname.pm index 2a621a9112..1552ed0a10 100644 --- a/cpan/autodie/t/lib/autodie/test/badname.pm +++ b/cpan/autodie/t/lib/autodie/test/badname.pm @@ -1,5 +1,5 @@ package autodie::test::badname; -use base qw(autodie); +use parent qw(autodie); sub exception_class { return 'autodie::test::badname::$@#%'; # Doesn't exist! diff --git a/cpan/autodie/t/lib/autodie/test/missing.pm b/cpan/autodie/t/lib/autodie/test/missing.pm index b6166a53a4..82f20963f9 100644 --- a/cpan/autodie/t/lib/autodie/test/missing.pm +++ b/cpan/autodie/t/lib/autodie/test/missing.pm @@ -1,5 +1,5 @@ package autodie::test::missing; -use base qw(autodie); +use parent qw(autodie); sub exception_class { return "autodie::test::missing::exception"; # Doesn't exist! diff --git a/cpan/autodie/t/lib/lethal.pm b/cpan/autodie/t/lib/lethal.pm index a49600a58a..08c3cb6c5c 100644 --- a/cpan/autodie/t/lib/lethal.pm +++ b/cpan/autodie/t/lib/lethal.pm @@ -3,6 +3,6 @@ package lethal; # A dummy package showing how we can trivially subclass autodie # to our tastes. -use base qw(autodie); +use parent qw(autodie); 1; diff --git a/cpan/autodie/t/lib/my/autodie.pm b/cpan/autodie/t/lib/my/autodie.pm index 1ad12505a4..9b909bf4c6 100644 --- a/cpan/autodie/t/lib/my/autodie.pm +++ b/cpan/autodie/t/lib/my/autodie.pm @@ -2,7 +2,7 @@ package my::autodie; use strict; use warnings; -use base qw(autodie); +use parent qw(autodie); use autodie::exception; use autodie::hints; diff --git a/cpan/autodie/t/lib/my/pragma.pm b/cpan/autodie/t/lib/my/pragma.pm new file mode 100644 index 0000000000..185d54fb93 --- /dev/null +++ b/cpan/autodie/t/lib/my/pragma.pm @@ -0,0 +1,16 @@ +package my::pragma; + +use Import::Into qw(into); + +sub import { + shift(@_); + autodie->import::into(1, @_); + return; +} + +sub dont_die { + open(my $fd, '<', 'random-file'); + return $fd; +} + +1; diff --git a/cpan/autodie/t/lib/pujHa/ghach.pm b/cpan/autodie/t/lib/pujHa/ghach.pm index a55164b1a2..530c7815df 100644 --- a/cpan/autodie/t/lib/pujHa/ghach.pm +++ b/cpan/autodie/t/lib/pujHa/ghach.pm @@ -17,7 +17,7 @@ package pujHa'ghach; use strict; use warnings; -use base qw(autodie); +use parent qw(autodie); sub exception_class { return "pujHa'ghach::Dotlh"; # Dotlh - status diff --git a/cpan/autodie/t/lib/pujHa/ghach/Dotlh.pm b/cpan/autodie/t/lib/pujHa/ghach/Dotlh.pm index c7bbf8b1f6..2fbf3db455 100644 --- a/cpan/autodie/t/lib/pujHa/ghach/Dotlh.pm +++ b/cpan/autodie/t/lib/pujHa/ghach/Dotlh.pm @@ -9,7 +9,7 @@ package pujHa'ghach::Dotlh; use strict; use warnings; -use base qw(autodie::exception); +use parent qw(autodie::exception); sub stringify { my ($this) = @_; diff --git a/cpan/autodie/t/read.t b/cpan/autodie/t/read.t new file mode 100644 index 0000000000..152bf31ca8 --- /dev/null +++ b/cpan/autodie/t/read.t @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use autodie; + +use Test::More tests => 2; + +my $buffer = 'should-not-appear'; +eval { + read('BOFH', $buffer, 1024); +}; +like($@, qr/Can't read\(BOFH, <BUFFER>, 1024\)/, + 'read should not show the buffer'); +eval { + read('BOFH', $buffer, 1024, 5); +}; +like($@, qr/Can't read\(BOFH, <BUFFER>, 1024, 5\)/, + 'read should not show the buffer'); diff --git a/cpan/autodie/t/truncate.t b/cpan/autodie/t/truncate.t index 7af7226428..a2acfebf54 100644 --- a/cpan/autodie/t/truncate.t +++ b/cpan/autodie/t/truncate.t @@ -11,7 +11,7 @@ my ($truncate_status, $tmpfh, $tmpfile); # Some systems have a screwy tempfile. We don't run our tests there. eval { - ($tmpfh, $tmpfile) = tempfile(); + ($tmpfh, $tmpfile) = tempfile(UNLINK => 1); }; if ($@ or !defined $tmpfh) { diff --git a/cpan/autodie/t/utf8_open.t b/cpan/autodie/t/utf8_open.t index d328853b1b..5ccd5e3a5f 100644 --- a/cpan/autodie/t/utf8_open.t +++ b/cpan/autodie/t/utf8_open.t @@ -9,7 +9,6 @@ use autodie; use Fcntl; use File::Temp; - use Test::More; if( $] < '5.01000' ) { @@ -73,6 +72,15 @@ else { my @layers = PerlIO::get_layers($fh); ok( (grep { $_ eq 'utf8' } @layers), "open implicit read honors open pragma" ) or diag join ", ", @layers; } + + # raw + { + open my $fh, ">:raw", $file; + + my @layers = PerlIO::get_layers($fh); + + ok( !(grep { $_ eq 'utf8' } @layers), 'open pragma is not used if raw is specified' ) or diag join ", ", @layers; + } } diff --git a/cpan/autodie/t/version.t b/cpan/autodie/t/version.t index a729129e88..7accf05dc0 100644 --- a/cpan/autodie/t/version.t +++ b/cpan/autodie/t/version.t @@ -1,6 +1,11 @@ #!/usr/bin/perl -w use strict; -use Test::More tests => 4; +use Test::More; + +if (not $ENV{RELEASE_TESTING}) { + plan( skip_all => 'Release test. Set $ENV{RELEASE_TESTING} to true to run.'); +} +plan tests => 8; # For the moment, we'd like all our versions to be the same. # In order to play nicely with some code scanners, they need to be @@ -13,6 +18,10 @@ require autodie::hints; require autodie::exception; require autodie::exception::system; +ok(defined($autodie::VERSION), 'autodie has a version'); +ok(defined($autodie::exception::VERSION), 'autodie::exception has a version'); +ok(defined($autodie::hints::VERSION), 'autodie::hints has a version'); +ok(defined($Fatal::VERSION), 'Fatal has a version'); is($Fatal::VERSION, $autodie::VERSION); is($autodie::VERSION, $autodie::exception::VERSION); is($autodie::exception::VERSION, $autodie::exception::system::VERSION); diff --git a/cpan/autodie/t/version_tag.t b/cpan/autodie/t/version_tag.t index 2a01351b4c..4860a49837 100644 --- a/cpan/autodie/t/version_tag.t +++ b/cpan/autodie/t/version_tag.t @@ -21,7 +21,9 @@ my $version = $autodie::VERSION; SKIP: { - if ($version =~ /_/) { skip "Tag test skipped on dev release", 1 } + if (not defined($version) or $version =~ /_/) { + skip "Tag test skipped on dev release", 1; + } # Expanding our current version should work! eval { my $foo = autodie->_expand_tag(":$version"); }; |