diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2013-05-26 13:56:17 +0100 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2013-05-26 14:18:01 +0100 |
commit | 273225d4fa4dfa112b49b1cb5b087814b160dd32 (patch) | |
tree | b5a0af957e838513f6093f07e40d9aba55171b4c /cpan/autodie/t/unlink.t | |
parent | 762dbf22cb22645771fc27b5d197fd40cbbd9da8 (diff) | |
download | perl-273225d4fa4dfa112b49b1cb5b087814b160dd32.tar.gz |
Update autodie to CPAN version 2.19
[DELTA]
2.19 2013-05-13 10:02:15 Australia/Melbourne
* BUGFIX: Loading a file that does not change packages while
autodie in effect no longer causes weird behaviour when
slurpy built-ins (like open() and unlink()) are called. GH #22
Thanks to Niels Thykier.
* TEST: Tests for leak guard failures for slurpy core functions.
2.18 2013-05-12 18:12:14 Australia/Melbourne
* TEST: More testing in scope_leak.t.
* TEST: More testing around packages in truncate.t.
* SPEED / INTERNAL: Significant improvements in load time,
especially when autodie is used across multiple files,
by caching reuseable subroutines and reducing calls to eval "".
Huge thanks to Niels Thykier, who is a hero of the
free people, and completely and utterly awesome.
(RT #46984)
* DOCUMENTATION: Spelling and correction fixes,
courtesy David Steinbrunner.
* DEVEL: Faster and more robust testing with travis-ci.
* DEVEL: Some simple benchmarks bundled in the benchmarks/ directory.
2.17 2013-04-29 01:03:50 Australia/Melbourne
* DOCS: Spelling fixes thanks to dsteinbrunner! (RT #84897)
* DOCS: Fixed github links to point to 'pjf' rather than
'pfenwick' (GH #18, thanks to Lx!)
* INTERNAL: Silence warnings about experimental smart-match on
5.17.11+ (via Brian Fraser and p5p)
* TEST / BUILD: Generate .travis.yml files for CI testing via
dzil.
2.16 2013-02-23 01:49:16 Australia/Melbourne
* BUGFIX: Fix breakages under 5.8.x related to the new
autodie::skip feature.
* BUILD / BUGFIX: Remove dependency on parent.pm.
2.15 2013-02-22 23:55:22 Australia/Melbourne
* BUILD / BUGFIX: Correct meta-info that wanted at least Perl
v5.8.40, rather than v5.8.4. Giant thanks to Paul Howarth
for spotting this!
2.14 2013-02-22 15:43:33 Australia/Melbourne
* FEATURE: Classes which claim they ->DOES('autodie::skip') are now
skipped when generating exceptions. This is mainly of use to
utility classes. See `perldoc autodie::skip` for more details.
(GH Issue #15)
* FEATURE / BUGFIX / INCOMPAT: 'chmod' is now in the ':filesys'
category (was in ':file').
* BUGFIX: Added support for 'chown' and 'utime', that was
previously overlooked. Mad props to RsrchBoy for spotting this.
These are all in the ':filesys' category.
(GH Pull #13)
* BUGFIX: Added support for 'kill'. This is part of the
':ipc' category.
* BUGFIX: Fixed bug whereby chmod, chown, kill, unlink and
utime would not throw an exception when they didn't
change all their files or signal all their processes.
* TEST: truncate.t is now skipped on systems that don't have a
working File::Temp.
* TEST: open.t has a few more tests for exotic modes.
* TEST: chown() tests are skipped on Win32, as chown on Windows
is a no-op. (Thanks to Mithaldu for spotting this!)
* TEST: Author tests now look for the AUTHOR_TESTING env
variable (for dzil compliance).
* TEST: Better testing for chown, chmod, and unlink.
* TEST: Better testing for utime.
* TEST: kwalitee.t is now only run when $ENV{RELEASE_TESTING} is set.
* BUGFIX: Removed executable bits from some bundled text files.
* BUILD: We now use dzil to manage autodie.
* BUILD: Only Perl 5.8.4 and above is supported by autodie.
Please upgrade your Perl distro if you're using 5.8.3 or
below.
Diffstat (limited to 'cpan/autodie/t/unlink.t')
-rw-r--r-- | cpan/autodie/t/unlink.t | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/cpan/autodie/t/unlink.t b/cpan/autodie/t/unlink.t index f301500fda..c9d5168e64 100644 --- a/cpan/autodie/t/unlink.t +++ b/cpan/autodie/t/unlink.t @@ -2,13 +2,10 @@ use strict; use Test::More; use FindBin qw($Bin); -use constant TMPFILE => "$Bin/unlink_test_delete_me"; +use constant TMPFILE => "$Bin/unlink_test_delete_me"; +use constant NO_SUCH_FILE => 'this_file_had_better_not_be_here_at_all'; -# Create a file to practice unlinking -open(my $fh, ">", TMPFILE) - or plan skip_all => "Unable to create test file: $!"; -print {$fh} "Test\n"; -close $fh; +make_file(TMPFILE); # Check that file now exists -e TMPFILE or plan skip_all => "Failed to create test file"; @@ -20,17 +17,14 @@ unlink TMPFILE; if(-e TMPFILE) {plan skip_all => "Failed to delete test file: $!";} # Re-create file -open(my $fh2, ">", TMPFILE) - or plan skip_all => "Unable to create test file: $!"; -print {$fh2} "Test\n"; -close $fh2; +make_file(TMPFILE); # Check that file now exists -e TMPFILE or plan skip_all => "Failed to create test file"; -plan tests => 6; +plan tests => 10; -# Try to delete directory (this should succeed) +# Try to delete file (this should succeed) eval { use autodie; @@ -50,3 +44,25 @@ isa_ok($@, "autodie::exception", "... errors are of the correct type"); ok($@->matches("unlink"), "... it's also a unlink object"); ok($@->matches(":filesys"), "... and a filesys object"); +# Autodie should throw if we delete a LIST of files, but can only +# delete some of them. + +make_file(TMPFILE); +ok(-e TMPFILE, "Sanity: file exists"); + +eval { + use autodie; + + unlink TMPFILE, NO_SUCH_FILE; +}; + +ok($@, "Failure when trying to delete missing file in list."); +isa_ok($@, "autodie::exception", "... errors are of the correct type"); +is($@->return,1, "Failure on deleting missing file but true return value"); + +sub make_file { + open(my $fh, ">", $_[0]) + or plan skip_all => "Unable to create test file $_[0]: $!"; + print {$fh} "Test\n"; + close $fh; +} |