r16440 - in /branches/upstream/libtest-exception-perl/current: Build.PL Changes MANIFEST META.yml Makefile.PL README lib/Test/Exception.pm t/developer/spelling.t t/edge-cases.t t/lives_and.t t/return.t
tincho-guest at users.alioth.debian.org
tincho-guest at users.alioth.debian.org
Tue Mar 4 04:21:07 UTC 2008
Author: tincho-guest
Date: Tue Mar 4 04:21:06 2008
New Revision: 16440
URL: http://svn.debian.org/wsvn/?sc=1&rev=16440
Log:
[svn-upgrade] Integrating new upstream version, libtest-exception-perl (0.26)
Added:
branches/upstream/libtest-exception-perl/current/t/edge-cases.t
Modified:
branches/upstream/libtest-exception-perl/current/Build.PL
branches/upstream/libtest-exception-perl/current/Changes
branches/upstream/libtest-exception-perl/current/MANIFEST
branches/upstream/libtest-exception-perl/current/META.yml
branches/upstream/libtest-exception-perl/current/Makefile.PL
branches/upstream/libtest-exception-perl/current/README
branches/upstream/libtest-exception-perl/current/lib/Test/Exception.pm
branches/upstream/libtest-exception-perl/current/t/developer/spelling.t
branches/upstream/libtest-exception-perl/current/t/lives_and.t
branches/upstream/libtest-exception-perl/current/t/return.t
Modified: branches/upstream/libtest-exception-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-exception-perl/current/Build.PL?rev=16440&op=diff
==============================================================================
--- branches/upstream/libtest-exception-perl/current/Build.PL (original)
+++ branches/upstream/libtest-exception-perl/current/Build.PL Tue Mar 4 04:21:06 2008
@@ -5,12 +5,12 @@
license => 'perl',
requires => {
'perl' => '5.6.1',
- 'Test::Simple' => '0.62',
- 'Test::Builder' => '0.33',
- 'Test::Builder::Tester' => '1.04',
- 'Test::More' => '0.44',
+ 'Test::Simple' => '0.7',
+ 'Test::Builder' => '0.7',
+ 'Test::Builder::Tester' => '1.07',
+ 'Test::More' => '0.7',
'Test::Harness' => '2.03',
- 'Sub::Uplevel' => '0.13',
+ 'Sub::Uplevel' => '0.18',
},
create_makefile_pl => 'traditional',
create_readme => 1,
Modified: branches/upstream/libtest-exception-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-exception-perl/current/Changes?rev=16440&op=diff
==============================================================================
--- branches/upstream/libtest-exception-perl/current/Changes (original)
+++ branches/upstream/libtest-exception-perl/current/Changes Tue Mar 4 04:21:06 2008
@@ -1,4 +1,17 @@
Revision history for Perl extension Test::Exception:
+
+0.26
+ - Added some more exposition on the usage of dies_ok() and lives_ok() for
+ those who found them confusing. Also reordered presentation of docs so
+ more specific throws_ok() comes first.
+ - Some misc. documentation tweaks.
+ - Added some tests for RT#24678, but not actually fixed them yet
+ (thanks to Joshua ben Jore & David Golden). They skip for now.
+ - Tests should now pass on Strawberry/Vanilla Perl (thanks Nadim Khemir
+ & Chris Dolan)
+ - Added comment in docs about T::E not catching exit() in eval() blocks
+ (thanks Peter Scott)
+ - Updated Test::* & Sub::Uplevel version dependencies to something modern
0.25
- Updated Test::Simple dependency to make sure it is in sync with
Modified: branches/upstream/libtest-exception-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-exception-perl/current/MANIFEST?rev=16440&op=diff
==============================================================================
--- branches/upstream/libtest-exception-perl/current/MANIFEST (original)
+++ branches/upstream/libtest-exception-perl/current/MANIFEST Tue Mar 4 04:21:06 2008
@@ -1,16 +1,14 @@
Build.PL
Changes
lib/Test/Exception.pm
-Makefile.PL
MANIFEST This list of files
-META.yml
-README
t/caller.t
t/developer/documented.t
t/developer/perlcritic.t
t/developer/perlcriticrc
t/developer/pod.t
t/developer/spelling.t
+t/edge-cases.t
t/Exception.t
t/import.t
t/isa.t
@@ -20,3 +18,6 @@
t/rt.t
t/stacktrace.t
t/throws_ok.t
+Makefile.PL
+README
+META.yml
Modified: branches/upstream/libtest-exception-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-exception-perl/current/META.yml?rev=16440&op=diff
==============================================================================
--- branches/upstream/libtest-exception-perl/current/META.yml (original)
+++ branches/upstream/libtest-exception-perl/current/META.yml Tue Mar 4 04:21:06 2008
@@ -1,6 +1,6 @@
---
name: Test-Exception
-version: 0.25
+version: 0.26
author:
- 'Adrian Howard <adrianh at quietstars.com>'
abstract: Test exception based code
@@ -8,18 +8,18 @@
resources:
license: http://dev.perl.org/licenses/
requires:
- Sub::Uplevel: 0.13
- Test::Builder: 0.33
- Test::Builder::Tester: 1.04
+ Sub::Uplevel: 0.18
+ Test::Builder: 0.7
+ Test::Builder::Tester: 1.07
Test::Harness: 2.03
- Test::More: 0.44
- Test::Simple: 0.62
+ Test::More: 0.7
+ Test::Simple: 0.7
perl: 5.6.1
provides:
Test::Exception:
file: lib/Test/Exception.pm
- version: 0.25
-generated_by: Module::Build version 0.2806
+ version: 0.26
+generated_by: Module::Build version 0.2808
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.2.html
version: 1.2
Modified: branches/upstream/libtest-exception-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-exception-perl/current/Makefile.PL?rev=16440&op=diff
==============================================================================
--- branches/upstream/libtest-exception-perl/current/Makefile.PL (original)
+++ branches/upstream/libtest-exception-perl/current/Makefile.PL Tue Mar 4 04:21:06 2008
@@ -5,12 +5,12 @@
'NAME' => 'Test::Exception',
'VERSION_FROM' => 'lib/Test/Exception.pm',
'PREREQ_PM' => {
- 'Sub::Uplevel' => '0.13',
- 'Test::Builder' => '0.33',
- 'Test::Builder::Tester' => '1.04',
+ 'Sub::Uplevel' => '0.18',
+ 'Test::Builder' => '0.7',
+ 'Test::Builder::Tester' => '1.07',
'Test::Harness' => '2.03',
- 'Test::More' => '0.44',
- 'Test::Simple' => '0.62'
+ 'Test::More' => '0.7',
+ 'Test::Simple' => '0.7'
},
'INSTALLDIRS' => 'site',
'EXE_FILES' => [],
Modified: branches/upstream/libtest-exception-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-exception-perl/current/README?rev=16440&op=diff
==============================================================================
--- branches/upstream/libtest-exception-perl/current/README (original)
+++ branches/upstream/libtest-exception-perl/current/README Tue Mar 4 04:21:06 2008
@@ -11,33 +11,33 @@
# then...
- # Check that something died
- dies_ok { $foo->method1 } 'expecting to die';
-
- # Check that something did not die
- lives_ok { $foo->method2 } 'expecting to live';
-
# Check that the stringified exception matches given regex
- throws_ok { $foo->method3 } qr/division by zero/, 'zero caught okay';
+ throws_ok { $foo->method } qr/division by zero/, 'zero caught okay';
# Check an exception of the given class (or subclass) is thrown
- throws_ok { $foo->method4 } 'Error::Simple', 'simple error thrown';
+ throws_ok { $foo->method } 'Error::Simple', 'simple error thrown';
# all Test::Exceptions subroutines are guaranteed to preserve the state
# of $@ so you can do things like this after throws_ok and dies_ok
like $@, 'what the stringified exception should look like';
+ # Check that something died - we do not care why
+ dies_ok { $foo->method } 'expecting to die';
+
+ # Check that something did not die
+ lives_ok { $foo->method } 'expecting to live';
+
# Check that a test runs without an exception
lives_and { is $foo->method, 42 } 'method is 42';
# or if you don't like prototyped functions
- dies_ok( sub { $foo->method1 }, 'expecting to die' );
- lives_ok( sub { $foo->method2 }, 'expecting to live' );
- throws_ok( sub { $foo->method3 }, qr/division by zero/,
+ throws_ok( sub { $foo->method }, qr/division by zero/,
'zero caught okay' );
- throws_ok( sub { $foo->method4 }, 'Error::Simple',
+ throws_ok( sub { $foo->method }, 'Error::Simple',
'simple error thrown' );
+ dies_ok( sub { $foo->method }, 'expecting to die' );
+ lives_ok( sub { $foo->method }, 'expecting to live' );
lives_and( sub { is $foo->method, 42 }, 'method is 42' );
DESCRIPTION
@@ -51,6 +51,63 @@
You can specify the test plan when you "use Test::Exception" in the same
way as "use Test::More". See Test::More for details.
+ NOTE: Test::Exception only checks for exceptions. It will ignore other
+ methods of stopping program execution - including exit(). If you have an
+ exit() in evalled code Test::Exception will not catch this with any of
+ its testing functions.
+
+ throws_ok
+ Tests to see that a specific exception is thrown. throws_ok() has
+ two forms:
+
+ throws_ok BLOCK REGEX, TEST_DESCRIPTION
+ throws_ok BLOCK CLASS, TEST_DESCRIPTION
+
+ In the first form the test passes if the stringified exception
+ matches the give regular expression. For example:
+
+ throws_ok { read_file( 'unreadable' ) } qr/No file/, 'no file';
+
+ If your perl does not support "qr//" you can also pass a regex-like
+ string, for example:
+
+ throws_ok { read_file( 'unreadable' ) } '/No file/', 'no file';
+
+ The second form of throws_ok() test passes if the exception is of
+ the same class as the one supplied, or a subclass of that class. For
+ example:
+
+ throws_ok { $foo->bar } "Error::Simple", 'simple error';
+
+ Will only pass if the "bar" method throws an Error::Simple
+ exception, or a subclass of an Error::Simple exception.
+
+ You can get the same effect by passing an instance of the exception
+ you want to look for. The following is equivalent to the previous
+ example:
+
+ my $SIMPLE = Error::Simple->new;
+ throws_ok { $foo->bar } $SIMPLE, 'simple error';
+
+ Should a throws_ok() test fail it produces appropriate diagnostic
+ messages. For example:
+
+ not ok 3 - simple error
+ # Failed test (test.t at line 48)
+ # expecting: Error::Simple exception
+ # found: normal exit
+
+ Like all other Test::Exception functions you can avoid prototypes by
+ passing a subroutine explicitly:
+
+ throws_ok( sub {$foo->bar}, "Error::Simple", 'simple error' );
+
+ A true value is returned if the test succeeds, false otherwise. On
+ exit $@ is guaranteed to be the cause of death (if any).
+
+ A description of the exception being checked is used if no optional
+ test description is passed.
+
dies_ok
Checks that a piece of code dies, rather than returning normally.
For example:
@@ -68,11 +125,16 @@
A true value is returned if the test succeeds, false otherwise. On
exit $@ is guaranteed to be the cause of death (if any).
+ Remember: This test will pass if the code dies for any reason. If
+ you care about the reason it might be more sensible to write a more
+ specific test using throws_ok().
+
The test description is optional, but recommended.
lives_ok
- Checks that a piece of code exits normally, and doesn't die. For
- example:
+ Checks that a piece of code doesn't die. This allows your test
+ script to continue, rather than aborting if you get an unexpected
+ exception. For example:
sub read_file {
my $file = shift;
@@ -100,58 +162,6 @@
The test description is optional, but recommended.
- throws_ok
- Tests to see that a specific exception is thrown. throws_ok() has
- two forms:
-
- throws_ok BLOCK REGEX, TEST_DESCRIPTION
- throws_ok BLOCK CLASS, TEST_DESCRIPTION
-
- In the first form the test passes if the stringified exception
- matches the give regular expression. For example:
-
- throws_ok { read_file( 'unreadable' ) } qr/No file/, 'no file';
-
- If your perl does not support "qr//" you can also pass a regex-like
- string, for example:
-
- throws_ok { read_file( 'unreadable' ) } '/No file/', 'no file';
-
- The second form of throws_ok() test passes if the exception is of
- the same class as the one supplied, or a subclass of that class. For
- example:
-
- throws_ok { $foo->bar } "Error::Simple", 'simple error';
-
- Will only pass if the "bar" method throws an Error::Simple
- exception, or a subclass of an Error::Simple exception.
-
- You can get the same effect by passing an instance of the exception
- you want to look for. The following is equivalent to the previous
- example:
-
- my $SIMPLE = Error::Simple->new;
- throws_ok { $foo->bar } $SIMPLE, 'simple error';
-
- Should a throws_ok() test fail it produces appropriate diagnostic
- messages. For example:
-
- not ok 3 - simple error
- # Failed test (test.t at line 48)
- # expecting: Error::Simple exception
- # found: normal exit
-
- Like all other Test::Exception functions you can avoid prototypes by
- passing a subroutine explicitly:
-
- throws_ok( sub {$foo->bar}, "Error::Simple", 'simple error' );
-
- A true value is returned if the test succeeds, false otherwise. On
- exit $@ is guaranteed to be the cause of death (if any).
-
- A description of the exception being checked is used if no optional
- test description is passed.
-
lives_and
Run a test that may throw an exception. For example, instead of
doing:
@@ -205,10 +215,14 @@
compiled.
BUGS
- None known at the time of writing.
-
- If you find any please let me know by e-mail, or report the problem with
- <http://rt.cpan.org/>.
+ There are some edge cases in Perl's exception handling where
+ Test::Exception will miss exceptions thrown in DESTROY blocks. See the
+ RT bug <http://rt.cpan.org/Ticket/Display.html?id=24678> for details,
+ along with the t/edge-cases.t in the distribution test suite. These will
+ be addressed in a future Test::Exception release.
+
+ If you find any more bugs please let me know by e-mail, or report the
+ problem with <http://rt.cpan.org/>.
COMMUNITY
perl-qa
@@ -244,12 +258,13 @@
Thanks to chromatic and Michael G Schwern for the excellent
Test::Builder, without which this module wouldn't be possible.
- Thanks to Adam Kennedy, Andy Lester, Aristotle, Ben Prew, Cees Hek,
- chromatic, Curt Sampson, David Cantrell, David Golden, David Wheeler,
- Janek Schleicher, Jim Keenan, Jos I. Boumans, Jost Krieger, Mark Fowler,
- Michael G Schwern, Paul McCann, Perrin Harkins, Peter Scott, Rob
- Muhlestein Scott R. Godin, Steve Purkis, Steve, Tim Bunce, and various
- anonymous folk for comments, suggestions, bug reports and patches.
+ Thanks to Adam Kennedy, Andy Lester, Aristotle Pagaltzis, Ben Prew, Cees
+ Hek, Chris Dolan, chromatic, Curt Sampson, David Cantrell, David Golden,
+ David Wheeler, Janek Schleicher, Jim Keenan, Jos I. Boumans, Joshua ben
+ Jore, Jost Krieger, Mark Fowler, Michael G Schwern, Nadim Khemir, Paul
+ McCann, Perrin Harkins, Peter Scott, Rob Muhlestein Scott R. Godin,
+ Steve Purkis, Steve, Tim Bunce, and various anonymous folk for comments,
+ suggestions, bug reports and patches.
AUTHOR
Adrian Howard <adrianh at quietstars.com>
@@ -258,21 +273,21 @@
useful.
SEE ALSO
+ <http://del.icio.us/tag/Test::Exception>
+ Delicious links on Test::Exception.
+
+ Test::Warn & Test::NoWarnings
+ Modules to help test warnings.
+
Test::Builder
Support module for building test libraries.
Test::Simple & Test::More
Basic utilities for writing tests.
- Test::Warn & Test::NoWarnings
- Modules to help test warnings.
-
<http://qa.perl.org/test-modules.html>
Overview of some of the many testing modules available on CPAN.
- <http://del.icio.us/tag/Test::Exception>
- Delicious links on Test::Exception.
-
<http://del.icio.us/tag/perl+testing>
Delicious links on perl testing.
Modified: branches/upstream/libtest-exception-perl/current/lib/Test/Exception.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-exception-perl/current/lib/Test/Exception.pm?rev=16440&op=diff
==============================================================================
--- branches/upstream/libtest-exception-perl/current/lib/Test/Exception.pm (original)
+++ branches/upstream/libtest-exception-perl/current/lib/Test/Exception.pm Tue Mar 4 04:21:06 2008
@@ -7,7 +7,7 @@
use base qw( Exporter );
use Carp;
-our $VERSION = '0.25';
+our $VERSION = '0.26';
our @EXPORT = qw(dies_ok lives_ok throws_ok lives_and);
my $Tester = Test::Builder->new;
@@ -37,43 +37,49 @@
# then...
- # Check that something died
- dies_ok { $foo->method1 } 'expecting to die';
-
- # Check that something did not die
- lives_ok { $foo->method2 } 'expecting to live';
-
# Check that the stringified exception matches given regex
- throws_ok { $foo->method3 } qr/division by zero/, 'zero caught okay';
+ throws_ok { $foo->method } qr/division by zero/, 'zero caught okay';
# Check an exception of the given class (or subclass) is thrown
- throws_ok { $foo->method4 } 'Error::Simple', 'simple error thrown';
+ throws_ok { $foo->method } 'Error::Simple', 'simple error thrown';
# all Test::Exceptions subroutines are guaranteed to preserve the state
# of $@ so you can do things like this after throws_ok and dies_ok
like $@, 'what the stringified exception should look like';
+
+ # Check that something died - we do not care why
+ dies_ok { $foo->method } 'expecting to die';
+
+ # Check that something did not die
+ lives_ok { $foo->method } 'expecting to live';
# Check that a test runs without an exception
lives_and { is $foo->method, 42 } 'method is 42';
# or if you don't like prototyped functions
- dies_ok( sub { $foo->method1 }, 'expecting to die' );
- lives_ok( sub { $foo->method2 }, 'expecting to live' );
- throws_ok( sub { $foo->method3 }, qr/division by zero/,
+ throws_ok( sub { $foo->method }, qr/division by zero/,
'zero caught okay' );
- throws_ok( sub { $foo->method4 }, 'Error::Simple',
+ throws_ok( sub { $foo->method }, 'Error::Simple',
'simple error thrown' );
+ dies_ok( sub { $foo->method }, 'expecting to die' );
+ lives_ok( sub { $foo->method }, 'expecting to live' );
lives_and( sub { is $foo->method, 42 }, 'method is 42' );
=head1 DESCRIPTION
-This module provides a few convenience methods for testing exception based code. It is built with L<Test::Builder> and plays happily with L<Test::More> and friends.
+This module provides a few convenience methods for testing exception based code. It is built with
+L<Test::Builder> and plays happily with L<Test::More> and friends.
If you are not already familiar with L<Test::More> now would be the time to go take a look.
-You can specify the test plan when you C<use Test::Exception> in the same way as C<use Test::More>. See L<Test::More> for details.
+You can specify the test plan when you C<use Test::Exception> in the same way as C<use Test::More>.
+See L<Test::More> for details.
+
+NOTE: Test::Exception only checks for exceptions. It will ignore other methods of stopping
+program execution - including exit(). If you have an exit() in evalled code Test::Exception
+will not catch this with any of its testing functions.
=cut
@@ -103,76 +109,6 @@
=over 4
-
-=item B<dies_ok>
-
-Checks that a piece of code dies, rather than returning normally. For example:
-
- sub div {
- my ( $a, $b ) = @_;
- return $a / $b;
- };
-
- dies_ok { div( 1, 0 ) } 'divide by zero detected';
-
- # or if you don't like prototypes
- dies_ok( sub { div( 1, 0 ) }, 'divide by zero detected' );
-
-A true value is returned if the test succeeds, false otherwise. On exit $@ is guaranteed to be the cause of death (if any).
-
-The test description is optional, but recommended.
-
-=cut
-
-
-sub dies_ok (&;$) {
- my ( $coderef, $description ) = @_;
- my $exception = _try_as_caller( $coderef );
- my $ok = $Tester->ok( _is_exception($exception), $description );
- $@ = $exception;
- return $ok;
-}
-
-
-=item B<lives_ok>
-
-Checks that a piece of code exits normally, and doesn't die. For example:
-
- sub read_file {
- my $file = shift;
- local $/;
- open my $fh, '<', $file or die "open failed ($!)\n";
- $file = <FILE>;
- return $file;
- };
-
- my $file;
- lives_ok { $file = read_file('test.txt') } 'file read';
-
- # or if you don't like prototypes
- lives_ok( sub { $file = read_file('test.txt') }, 'file read' );
-
-Should a lives_ok() test fail it produces appropriate diagnostic messages. For example:
-
- not ok 1 - file read
- # Failed test (test.t at line 15)
- # died: open failed (No such file or directory)
-
-A true value is returned if the test succeeds, false otherwise. On exit $@ is guaranteed to be the cause of death (if any).
-
-The test description is optional, but recommended.
-
-=cut
-
-sub lives_ok (&;$) {
- my ( $coderef, $description ) = @_;
- my $exception = _try_as_caller( $coderef );
- my $ok = $Tester->ok( ! _is_exception( $exception ), $description );
- $Tester->diag( _exception_as_string( "died:", $exception ) ) unless $ok;
- $@ = $exception;
- return $ok;
-}
-
=item B<throws_ok>
@@ -241,6 +177,77 @@
};
+=item B<dies_ok>
+
+Checks that a piece of code dies, rather than returning normally. For example:
+
+ sub div {
+ my ( $a, $b ) = @_;
+ return $a / $b;
+ };
+
+ dies_ok { div( 1, 0 ) } 'divide by zero detected';
+
+ # or if you don't like prototypes
+ dies_ok( sub { div( 1, 0 ) }, 'divide by zero detected' );
+
+A true value is returned if the test succeeds, false otherwise. On exit $@ is guaranteed to be the cause of death (if any).
+
+Remember: This test will pass if the code dies for any reason. If you care about the reason it might be more sensible to write a more specific test using throws_ok().
+
+The test description is optional, but recommended.
+
+=cut
+
+sub dies_ok (&;$) {
+ my ( $coderef, $description ) = @_;
+ my $exception = _try_as_caller( $coderef );
+ my $ok = $Tester->ok( _is_exception($exception), $description );
+ $@ = $exception;
+ return $ok;
+}
+
+
+=item B<lives_ok>
+
+Checks that a piece of code doesn't die. This allows your test script to continue, rather than aborting if you get an unexpected exception. For example:
+
+ sub read_file {
+ my $file = shift;
+ local $/;
+ open my $fh, '<', $file or die "open failed ($!)\n";
+ $file = <FILE>;
+ return $file;
+ };
+
+ my $file;
+ lives_ok { $file = read_file('test.txt') } 'file read';
+
+ # or if you don't like prototypes
+ lives_ok( sub { $file = read_file('test.txt') }, 'file read' );
+
+Should a lives_ok() test fail it produces appropriate diagnostic messages. For example:
+
+ not ok 1 - file read
+ # Failed test (test.t at line 15)
+ # died: open failed (No such file or directory)
+
+A true value is returned if the test succeeds, false otherwise. On exit $@ is guaranteed to be the cause of death (if any).
+
+The test description is optional, but recommended.
+
+=cut
+
+sub lives_ok (&;$) {
+ my ( $coderef, $description ) = @_;
+ my $exception = _try_as_caller( $coderef );
+ my $ok = $Tester->ok( ! _is_exception( $exception ), $description );
+ $Tester->diag( _exception_as_string( "died:", $exception ) ) unless $ok;
+ $@ = $exception;
+ return $ok;
+}
+
+
=item B<lives_and>
Run a test that may throw an exception. For example, instead of doing:
@@ -317,9 +324,13 @@
=head1 BUGS
-None known at the time of writing.
-
-If you find any please let me know by e-mail, or report the problem with L<http://rt.cpan.org/>.
+There are some edge cases in Perl's exception handling where Test::Exception will miss exceptions
+thrown in DESTROY blocks. See the RT bug L<http://rt.cpan.org/Ticket/Display.html?id=24678> for
+details, along with the t/edge-cases.t in the distribution test suite. These will be addressed in
+a future Test::Exception release.
+
+If you find any more bugs please let me know by e-mail, or report the problem with
+L<http://rt.cpan.org/>.
=head1 COMMUNITY
@@ -359,9 +370,10 @@
Thanks to
Adam Kennedy,
Andy Lester,
-Aristotle,
+Aristotle Pagaltzis,
Ben Prew,
Cees Hek,
+Chris Dolan,
chromatic,
Curt Sampson,
David Cantrell,
@@ -370,9 +382,11 @@
Janek Schleicher,
Jim Keenan,
Jos I. Boumans,
+Joshua ben Jore,
Jost Krieger,
Mark Fowler,
Michael G Schwern,
+Nadim Khemir,
Paul McCann,
Perrin Harkins,
Peter Scott,
@@ -395,6 +409,14 @@
=over 4
+=item L<http://del.icio.us/tag/Test::Exception>
+
+Delicious links on Test::Exception.
+
+=item L<Test::Warn> & L<Test::NoWarnings>
+
+Modules to help test warnings.
+
=item L<Test::Builder>
Support module for building test libraries.
@@ -403,18 +425,10 @@
Basic utilities for writing tests.
-=item L<Test::Warn> & L<Test::NoWarnings>
-
-Modules to help test warnings.
-
=item L<http://qa.perl.org/test-modules.html>
Overview of some of the many testing modules available on CPAN.
-=item L<http://del.icio.us/tag/Test::Exception>
-
-Delicious links on Test::Exception.
-
=item L<http://del.icio.us/tag/perl+testing>
Delicious links on perl testing.
Modified: branches/upstream/libtest-exception-perl/current/t/developer/spelling.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-exception-perl/current/t/developer/spelling.t?rev=16440&op=diff
==============================================================================
--- branches/upstream/libtest-exception-perl/current/t/developer/spelling.t (original)
+++ branches/upstream/libtest-exception-perl/current/t/developer/spelling.t Tue Mar 4 04:21:06 2008
@@ -4,13 +4,13 @@
use warnings;
use Test::More;
-my $aspell_path = eval q{
+my $ispell_path = eval q{
use Test::Spelling;
use File::Which;
- which('aspell') || die 'no aspell'
+ which('ispell') || die 'no ispell'
};
-plan skip_all => 'Optional Test::Spelling, File::Which and aspell program required to spellcheck POD' if $@;
-set_spell_cmd("$aspell_path list");
+plan skip_all => 'Optional Test::Spelling, File::Which and ispell program required to spellcheck POD' if $@;
+set_spell_cmd("$ispell_path -l");
add_stopwords( <DATA> );
all_pod_files_spelling_ok();
@@ -35,3 +35,13 @@
Jos
Jost
qa
+Adrian
+Cantrell
+Janek
+Jore
+ben
+Khemir
+Nadim
+Pagaltzis
+Dolan
+RT
Added: branches/upstream/libtest-exception-perl/current/t/edge-cases.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-exception-perl/current/t/edge-cases.t?rev=16440&op=file
==============================================================================
--- branches/upstream/libtest-exception-perl/current/t/edge-cases.t (added)
+++ branches/upstream/libtest-exception-perl/current/t/edge-cases.t Tue Mar 4 04:21:06 2008
@@ -1,0 +1,67 @@
+#! /usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More skip_all => 'stuff relating to RT#24678 that I have not fixed yet';
+
+use Test::Exception tests => 12;
+
+sub A1::DESTROY {eval{}}
+dies_ok { my $x = bless [], 'A1'; die } q[Unlocalized $@ for eval{} during DESTROY];
+
+sub A2::DESTROY {die 43 }
+throws_ok { my $x = bless [], 'A2'; die 42} qr/42.+43/s, q[Died with the primary and secondar errors];
+
+sub A2a::DESTROY { die 42 }
+throws_ok { my $obj = bless [], 'A2a'; die 43 } qr/43/,
+ q[Of multiple failures, the "primary" one is returned];
+
+{
+ sub A3::DESTROY {die}
+ dies_ok { my $x = bless [], 'A3'; 1 } q[Death during destruction for success is noticed];
+}
+
+
+sub A4::DESTROY {delete$SIG{__DIE__};eval{}}
+dies_ok { my $x = bless [], 'A4'; die } q[Unlocalized $@ for eval{} during DESTROY];
+
+sub A5::DESTROY {delete$SIG{__DIE__};die 43 }
+throws_ok { my $x = bless [], 'A5'; die 42} qr/42.+43/s, q[Died with the primary and secondar errors];
+
+TODO: {
+ our $TODO = q[No clue how to solve this one.];
+ sub A6::DESTROY {delete$SIG{__DIE__};die}
+ dies_ok { my $x = bless [], 'A6'; 1 } q[Death during destruction for success is noticed];
+}
+
+
+dies_ok { die bless [], 0 } q[Died with a "false" exception class];
+dies_ok { die bless [], "\0" } q[Died with a "false" exception class];
+
+package A7;
+use overload bool => sub { 0 }, '0+' => sub { 0 }, '""' => sub { '' }, fallback => 1;
+package main;
+dies_ok { die bless [], 'A7' } q[False overloaded exceptions are noticed];
+
+
+$main::{'0::'} = $main::{'A7::'};
+dies_ok { die bless [], 0 } q[Died a false death];
+
+
+package A8;
+use overload bool => sub {eval{};0}, '0+' => sub{eval{};0}, '""' => sub { eval{}; '' }, fallback => 1;
+package main;
+dies_ok { die bless [], 'A8' } q[Evanescent exceptions are noticed];
+
+
+__END__
+
+ dies_ok{ my $foo = Foo->new; die "Fatal Error" };
+ lives_ok{ my $foo = Foo->new; die "Fatal Error" };
+
+ not ok 1
+ # Code died, but appeared to live because $@ was reset
+ # unexpectedly by a DESTROY method called during cleanup
+ not ok 2
+ # Code died, but appeared to live because $@ was reset
+ # unexpectedly by a DESTROY method called during cleanup
Modified: branches/upstream/libtest-exception-perl/current/t/lives_and.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-exception-perl/current/t/lives_and.t?rev=16440&op=diff
==============================================================================
--- branches/upstream/libtest-exception-perl/current/t/lives_and.t (original)
+++ branches/upstream/libtest-exception-perl/current/t/lives_and.t Tue Mar 4 04:21:06 2008
@@ -10,6 +10,8 @@
sub works {return shift};
sub dies { die 'oops' };
+my $filename = sub { return (caller)[1] }->();
+
lives_and {is works(42), 42} 'lives_and, no_exception & success';
test_out('not ok 1 - lives_and, no_exception & failure');
@@ -20,7 +22,7 @@
test_out('not ok 2 - lives_and, exception');
test_fail(+2);
-test_err('# died: oops at t/lives_and.t line 11.');
+test_err("# died: oops at $filename line 11.");
lives_and {is dies(42), 42} 'lives_and, exception';
test_out('ok 3 - The object isa Foo' );
Modified: branches/upstream/libtest-exception-perl/current/t/return.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtest-exception-perl/current/t/return.t?rev=16440&op=diff
==============================================================================
--- branches/upstream/libtest-exception-perl/current/t/return.t (original)
+++ branches/upstream/libtest-exception-perl/current/t/return.t Tue Mar 4 04:21:06 2008
@@ -13,6 +13,8 @@
my ($a, $b) = @_;
return( $a / $b );
};
+
+my $filename = sub { return (caller)[1] }->();
{
my $ok = dies_ok { div(1, 0) } 'dies_ok passed on die';
@@ -54,7 +56,7 @@
{
test_out('not ok 1 - lives_ok failed');
test_fail(+2);
- test_err('# died: Illegal division by zero at t/return.t line 14.');
+ test_err("# died: Illegal division by zero at $filename line 14.");
my $ok = lives_ok { div(1, 0) } 'lives_ok failed';
test_test("dies_ok fails");
More information about the Pkg-perl-cvs-commits
mailing list