From 4ec232212b9cf5204c90cfa207fb3c8acd3fac9d09354846f4440f6d1f93f078 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Tue, 14 Apr 2015 05:07:19 +0000 Subject: [PATCH] Accepting request 295977 from devel:languages:perl:autoupdate automatic update OBS-URL: https://build.opensuse.org/request/show/295977 OBS-URL: https://build.opensuse.org/package/show/devel:languages:perl/perl-Test-Exception?expand=0&rev=34 --- Test-Exception-0.36.tar.gz | 3 - Test-Exception-0.38.tar.gz | 3 + perl-Test-Exception.changes | 12 +++ perl-Test-Exception.spec | 166 +++++++++++++++++++++++++++++++++--- 4 files changed, 170 insertions(+), 14 deletions(-) delete mode 100644 Test-Exception-0.36.tar.gz create mode 100644 Test-Exception-0.38.tar.gz diff --git a/Test-Exception-0.36.tar.gz b/Test-Exception-0.36.tar.gz deleted file mode 100644 index d20ddfa..0000000 --- a/Test-Exception-0.36.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b30bf587fdb6904e9dcfd6b21296ea7f2975c2c4019148b3e421e075758dfcfe -size 18694 diff --git a/Test-Exception-0.38.tar.gz b/Test-Exception-0.38.tar.gz new file mode 100644 index 0000000..d4d07f8 --- /dev/null +++ b/Test-Exception-0.38.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c6aa4c208c043c38631e2af8d28abf76d32a3dcd2ff4a94591f009a6ed3eab5 +size 15349 diff --git a/perl-Test-Exception.changes b/perl-Test-Exception.changes index dff0744..0e7b00d 100644 --- a/perl-Test-Exception.changes +++ b/perl-Test-Exception.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Mon Apr 13 18:27:40 UTC 2015 - coolo@suse.com + +- updated to 0.38 + see /usr/share/doc/packages/perl-Test-Exception/Changes + + 0.38 [2015-02-27] + - fixed repository link in metadata + + 0.37 [2015-02-27] + - distribution is now managed by ExtUtils::MakeMaker (RT#102054) + ------------------------------------------------------------------- Fri Feb 6 13:13:00 UTC 2015 - coolo@suse.com diff --git a/perl-Test-Exception.spec b/perl-Test-Exception.spec index dce059a..f761511 100644 --- a/perl-Test-Exception.spec +++ b/perl-Test-Exception.spec @@ -17,29 +17,25 @@ Name: perl-Test-Exception -Version: 0.36 +Version: 0.38 Release: 0 %define cpan_name Test-Exception Summary: Test exception based code License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Test-Exception/ -Source: http://www.cpan.org/authors/id/E/EX/EXODIST/%{cpan_name}-%{version}.tar.gz +Source: http://www.cpan.org/authors/id/E/ET/ETHER/%{cpan_name}-%{version}.tar.gz BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros -BuildRequires: perl(Module::Build) >= 0.42 BuildRequires: perl(Sub::Uplevel) >= 0.18 BuildRequires: perl(Test::Builder) >= 0.7 BuildRequires: perl(Test::Builder::Tester) >= 1.07 BuildRequires: perl(Test::More) >= 0.7 -BuildRequires: perl(Test::Simple) >= 0.7 Requires: perl(Sub::Uplevel) >= 0.18 Requires: perl(Test::Builder) >= 0.7 Requires: perl(Test::Builder::Tester) >= 1.07 -Requires: perl(Test::More) >= 0.7 -Requires: perl(Test::Simple) >= 0.7 %{perl_requires} %description @@ -53,23 +49,171 @@ the time to go take a look. You can specify the test plan when you 'use Test::Exception' in the same way as 'use Test::More'. See the Test::More manpage 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. + + NOTE: Remember when you 'die $string_without_a_trailing_newline' perl + will automatically add the current script line number, input line number + and a newline. This will form part of the string that throws_ok regular + expressions match against. + +* *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. + +* *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 = ; + 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. + +* *lives_and* + + Run a test that may throw an exception. For example, instead of doing: + + my $file; + lives_ok { $file = read_file('answer.txt') } 'read_file worked'; + is $file, "42", 'answer was 42'; + + You can use lives_and() like this: + + lives_and { is read_file('answer.txt'), "42" } 'answer is 42'; + # or if you don't like prototypes + lives_and(sub {is read_file('answer.txt'), "42"}, 'answer is 42'); + + Which is the same as doing + + is read_file('answer.txt'), "42\n", 'answer is 42'; + + unless 'read_file('answer.txt')' dies, in which case you get the same + kind of error as lives_ok() + + not ok 1 - answer is 42 + # 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. + %prep %setup -q -n %{cpan_name}-%{version} find . -type f -print0 | xargs -0 chmod 644 %build -%{__perl} Build.PL installdirs=vendor -./Build build flags=%{?_smp_mflags} +%{__perl} Makefile.PL INSTALLDIRS=vendor +%{__make} %{?_smp_mflags} %check -./Build test +%{__make} test %install -./Build install destdir=%{buildroot} create_packlist=0 +%perl_make_install +%perl_process_packlist %perl_gen_filelist %files -f %{name}.files %defattr(-,root,root,755) -%doc Changes README xt +%doc Changes %changelog