Hello community, here is the log from the commit of package perl-Test-Warn for openSUSE:Factory checked in at 2018-06-18 13:50:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Test-Warn (Old) and /work/SRC/openSUSE:Factory/.perl-Test-Warn.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Test-Warn" Mon Jun 18 13:50:23 2018 rev:26 rq:617442 version:0.35 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Test-Warn/perl-Test-Warn.changes 2017-01-15 11:11:34.685643528 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Test-Warn.new/perl-Test-Warn.changes 2018-06-18 13:50:26.212908890 +0200 @@ -1,0 +2,42 @@ +Fri Jun 15 06:05:43 UTC 2018 - co...@suse.com + +- updated to 0.35 + see /usr/share/doc/packages/perl-Test-Warn/Changes + + 0.35 2018-06-13 + Merged several Pull Requests: + - README clean-up: Assign Copyright to current author + https://github.com/hanfried/test-warn/pull/6 + thx to Andrew Grangaard (spazm) + - Pod cleanup + https://github.com/hanfried/test-warn/pull/5 + thx to Andrew Grangaar (spazm) and Gabor Szabo (szabgab) + - add missing comma + https://github.com/hanfried/test-warn/pull/4 + thx to Desmond Daignault (nawglan) + - Nawglan/update meta yml + https://github.com/hanfried/test-warn/pull/3 + thx to Desmond Daignault (nawglan) and Karen Etheridge (karenetheridge) + - create META.json so that perl Makefile.PL stops complaining + https://github.com/hanfried/test-warn/pull/2 + thx to Desmond Daignault (nawglan) and Karen Etheridge (karenetheridge) + +------------------------------------------------------------------- +Sun Jun 10 06:09:13 UTC 2018 - co...@suse.com + +- updated to 0.34 + see /usr/share/doc/packages/perl-Test-Warn/Changes + + 0.34 2018-05-31 + - Added a note that XS warnings might not be caught + https://rt.cpan.org/Ticket/Display.html?id=42070&results=3c71d1b101a730e185691657f3b02f21 + https://github.com/hanfried/test-warn/issues/1 + - Removed TODO section + - Updated Copyright section + + 0.33 2018-05-29 + - Patch from Era Eriksson to clean up some manpage language + Bug-Debian: #322351 + https://rt.cpan.org/Ticket/Display.html?id=49519 + +------------------------------------------------------------------- Old: ---- Test-Warn-0.32.tar.gz New: ---- Test-Warn-0.35.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Test-Warn.spec ++++++ --- /var/tmp/diff_new_pack.bcfrDx/_old 2018-06-18 13:50:27.636856257 +0200 +++ /var/tmp/diff_new_pack.bcfrDx/_new 2018-06-18 13:50:27.636856257 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Test-Warn # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,14 +17,14 @@ Name: perl-Test-Warn -Version: 0.32 +Version: 0.35 Release: 0 %define cpan_name Test-Warn Summary: Perl extension to test methods for warnings -License: Artistic-1.0 or GPL-1.0+ +License: Artistic-1.0 OR GPL-1.0-or-later Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Test-Warn/ -Source0: http://www.cpan.org/authors/id/B/BI/BIGJ/%{cpan_name}-%{version}.tar.gz +Source0: https://cpan.metacpan.org/authors/id/B/BI/BIGJ/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml BuildArch: noarch BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -40,8 +40,8 @@ A good style of Perl programming calls for a lot of diverse regression tests. -This module provides a few convenience methods for testing warning based -code. +This module provides a few convenience methods for testing warning +based-code. If you are not already familiar with the Test::More manpage now would be the time to go take a look. ++++++ Test-Warn-0.32.tar.gz -> Test-Warn-0.35.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Warn-0.32/Changes new/Test-Warn-0.35/Changes --- old/Test-Warn-0.32/Changes 2016-12-23 15:13:50.000000000 +0100 +++ new/Test-Warn-0.35/Changes 2018-06-13 09:49:33.000000000 +0200 @@ -1,5 +1,35 @@ Revision history for Perl extension Test::Warn. +0.35 2018-06-13 + Merged several Pull Requests: + - README clean-up: Assign Copyright to current author + https://github.com/hanfried/test-warn/pull/6 + thx to Andrew Grangaard (spazm) + - Pod cleanup + https://github.com/hanfried/test-warn/pull/5 + thx to Andrew Grangaar (spazm) and Gabor Szabo (szabgab) + - add missing comma + https://github.com/hanfried/test-warn/pull/4 + thx to Desmond Daignault (nawglan) + - Nawglan/update meta yml + https://github.com/hanfried/test-warn/pull/3 + thx to Desmond Daignault (nawglan) and Karen Etheridge (karenetheridge) + - create META.json so that perl Makefile.PL stops complaining + https://github.com/hanfried/test-warn/pull/2 + thx to Desmond Daignault (nawglan) and Karen Etheridge (karenetheridge) + +0.34 2018-05-31 + - Added a note that XS warnings might not be caught + https://rt.cpan.org/Ticket/Display.html?id=42070&results=3c71d1b101a730e185691657f3b02f21 + https://github.com/hanfried/test-warn/issues/1 + - Removed TODO section + - Updated Copyright section + +0.33 2018-05-29 + - Patch from Era Eriksson to clean up some manpage language + Bug-Debian: #322351 + https://rt.cpan.org/Ticket/Display.html?id=49519 + 0.32 2016-12-23 - updating github information - updating changes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Warn-0.32/META.json new/Test-Warn-0.35/META.json --- old/Test-Warn-0.32/META.json 2016-12-23 15:18:07.000000000 +0100 +++ new/Test-Warn-0.35/META.json 2018-06-13 09:49:57.000000000 +0200 @@ -1,10 +1,10 @@ { "abstract" : "Perl extension to test methods for warnings", "author" : [ - "Alexandr Ciornii <alexcho...@gmail.com>" + "Janek Schleicher <b...@kamelfreund.de>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.1, CPAN::Meta::Converter version 2.150005", + "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010", "keywords" : [ "testing", "warnings" @@ -58,6 +58,6 @@ "web" : "https://github.com/hanfried/test-warn" } }, - "version" : "0.32", - "x_serialization_backend" : "JSON::PP version 2.27300" + "version" : "0.35", + "x_serialization_backend" : "JSON::PP version 2.27400_02" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Warn-0.32/META.yml new/Test-Warn-0.35/META.yml --- old/Test-Warn-0.32/META.yml 2016-12-23 15:18:07.000000000 +0100 +++ new/Test-Warn-0.35/META.yml 2018-06-13 09:49:57.000000000 +0200 @@ -1,7 +1,7 @@ --- abstract: 'Perl extension to test methods for warnings' author: - - 'Alexandr Ciornii <alexcho...@gmail.com>' + - 'Janek Schleicher <b...@kamelfreund.de>' build_requires: ExtUtils::MakeMaker: '0' File::Spec: '0' @@ -9,7 +9,7 @@ configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.1, CPAN::Meta::Converter version 2.150005' +generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010' keywords: - testing - warnings @@ -30,5 +30,5 @@ perl: '5.006' resources: repository: git://github.com/hanfried/test-warn.git -version: '0.32' -x_serialization_backend: 'CPAN::Meta::YAML version 0.012' +version: '0.35' +x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Warn-0.32/Makefile.PL new/Test-Warn-0.35/Makefile.PL --- old/Test-Warn-0.32/Makefile.PL 2016-12-23 15:11:17.000000000 +0100 +++ new/Test-Warn-0.35/Makefile.PL 2018-05-29 10:46:13.000000000 +0200 @@ -21,7 +21,8 @@ }, 'LICENSE' => 'perl', 'MIN_PERL_VERSION' => 5.006, - AUTHOR => 'Alexandr Ciornii <alexchorny'.'@gmail.com>', + #AUTHOR => 'Alexandr Ciornii <alexchorny'.'@gmail.com>', + AUTHOR => 'Janek Schleicher <bigj'.'@kamelfreund.de>', META_MERGE => { 'meta-spec' => { version => 2 }, resources => { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Warn-0.32/README new/Test-Warn-0.35/README --- old/Test-Warn-0.32/README 2016-12-17 12:34:18.000000000 +0100 +++ new/Test-Warn-0.35/README 2018-06-13 09:43:51.000000000 +0200 @@ -1,4 +1,4 @@ -Test/Warn version 0.30 +Test/Warn version 0.35 ====================== INSTALLATION @@ -22,28 +22,30 @@ File::Spec SYNOPSIS + use Test::Warn; warning_is {foo(-dri => "/")} "Unknown Parameter 'dri'", "dri != dir gives warning"; warnings_are {bar(1,1)} ["Width very small", "Height very small"]; - + warning_is {add(2,2)} undef, "No warning to calc 2+2"; # or warnings_are {add(2,2)} [], "No warning to calc 2+2"; # what reads better :-) - + warning_like {foo(-dri => "/"} qr/unknown param/i, "an unknown parameter test"; warnings_like {bar(1,1)} [qr/width.*small/i, qr/height.*small/i]; - + warning_is {foo()} {carped => 'didn't found the right parameters'}; warnings_like {foo()} [qr/undefined/,qr/undefined/,{carped => qr/no result/i}]; - + warning_like {foo(undef)} 'uninitialized'; warning_like {bar(file => '/etc/passwd')} 'io'; - warning_like {eval q/"$x"; $x;/} - [qw/void uninitialized/], + warning_like {eval q/"$x"; $x;/} + [qw/void uninitialized/], "some warnings at compile time"; DESCRIPTION + This module provides a few convenience methods for testing warning based code. @@ -61,7 +63,7 @@ Have a look to the similar Test::Exception module. THANKS - Many thanks to Adrian Howard, chromatic and Michael G. Schwern, who all had + Many thanks to Adrian Howard, chromatic and Michael G. Schwern, who have given me a lot of ideas. AUTHOR @@ -69,7 +71,8 @@ COPYRIGHT AND LICENSE Copyright 2002 by Janek Schleicher - Copyright 2007-2014 by Alexandr Ciornii + Copyright 2007-2016 by Alexandr Ciornii + Copyright 2016-2018 by Janek Schleicher This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Warn-0.32/Warn.pm new/Test-Warn-0.35/Warn.pm --- old/Test-Warn-0.32/Warn.pm 2016-12-23 15:13:41.000000000 +0100 +++ new/Test-Warn-0.35/Warn.pm 2018-06-13 09:43:33.000000000 +0200 @@ -10,7 +10,7 @@ warnings_are {bar(1,1)} ["Width very small", "Height very small"]; warning_is {add(2,2)} undef, "No warnings for calc 2+2"; # or - warnings_are {add(2,2)} [], "No warnings for calc 2+2"; # what reads better :-) + warnings_are {add(2,2)} [], "No warnings for calc 2+2"; # whichever reads better :-) warning_like {foo(-dri => "/")} qr/unknown param/i, "an unknown parameter test"; warnings_like {bar(1,1)} [qr/width.*small/i, qr/height.*small/i]; @@ -21,8 +21,8 @@ warning_like {foo(undef)} 'uninitialized'; warning_like {bar(file => '/etc/passwd')} 'io'; - warning_like {eval q/"$x"; $x;/} - [qw/void uninitialized/], + warning_like {eval q/"$x"; $x;/} + [qw/void uninitialized/], "some warnings at compile time"; warnings_exist {...} [qr/expected warning/], "Expected warning is thrown"; @@ -31,143 +31,176 @@ A good style of Perl programming calls for a lot of diverse regression tests. -This module provides a few convenience methods for testing warning based code. +This module provides a few convenience methods for testing warning based-code. -If you are not already familiar with the Test::More manpage +If you are not already familiar with the L<Test::More> manpage now would be the time to go take a look. =head2 FUNCTIONS =over 4 -=item warning_is BLOCK STRING, TEST_NAME +=item B<warning_is> I<BLOCK STRING, TEST_NAME> Tests that BLOCK gives the specified warning exactly once. + The test fails if the BLOCK warns more than once or does not warn at all. -If the string is undef, -then the tests succeeds if the BLOCK doesn't give any warning. +If the string is undef, then the test succeeds if the BLOCK doesn't +give any warning. + Another way to say that there are no warnings in the block -is C<warnings_are {foo()} [], "no warnings">. +is: -If you want to test for a warning given by Carp, + warnings_are {foo()} [], "no warnings" + +If you want to test for a warning given by Carp you have to write something like: -C<warning_is {carp "msg"} {carped =E<gt> 'msg'}, "Test for a carped warning">. + + warning_is {carp "msg"} {carped => 'msg'}, "Test for a carped warning"; + The test will fail if a "normal" warning is found instead of a "carped" one. -Note: C<warn "foo"> would print something like C<foo at -e line 1>. +Note: C<warn "foo"> would print something like C<foo at -e line 1>. This method ignores everything after the "at". Thus to match this warning -you would have to call C<warning_is {warn "foo"} "foo", "Foo succeeded">. -If you need to test for a warning at an exactly line, -try something like C<warning_like {warn "foo"} qr/at XYZ.dat line 5/>. - -Warn messages with a trailing newline (like C<warn "foo\n">) don't produce the C<at -e line 1> message by Perl. Up to Test::Warn 0.30 such warning weren't supported by C<warning_is {warn "foo\n"} "foo\n">. Starting with version 0.31 they are supported, but also marked as experimental. - -warning_is and warning_are are only aliases to the same method. -So you also could write -C<warning_is {foo()} [], "no warning"> or something similar. +you would have to call C<< warning_is {warn "foo"} "foo", "Foo succeeded" >>. +If you need to test for a warning at an exact line, +try something like: + + warning_like {warn "foo"} qr/at XYZ.dat line 5/ + +Warn messages with a trailing newline (like C<warn "foo\n">) don't produce the C<at -e line 1> message by Perl. +Up to Test::Warn 0.30 such warning weren't supported by C<< warning_is {warn "foo\n"} "foo\n" >>. +Starting with version 0.31 they are supported, but also marked as experimental. + +L<C<warning_is()>|/warning_is-BLOCK-STRING-TEST_NAME> and L<C<warnings_are()>|/warnings_are-BLOCK-ARRAYREF-TEST_NAME> +are only aliases to the same method. So you also could write +C<< warning_is {foo()} [], "no warning" >> or something similar. + I decided to give two methods the same name to improve readability. A true value is returned if the test succeeds, false otherwise. The test name is optional, but recommended. - -=item warnings_are BLOCK ARRAYREF, TEST_NAME +=item B<warnings_are> I<BLOCK ARRAYREF, TEST_NAME> Tests to see that BLOCK gives exactly the specified warnings. The test fails if the warnings from BLOCK are not exactly the ones in ARRAYREF. -If the ARRAYREF is equal to [], +If the ARRAYREF is equal to C<< [] >>, then the test succeeds if the BLOCK doesn't give any warning. -Please read also the notes to warning_is as these methods are only aliases. +Please read also the notes to +L<C<warning_is()>|/warning_is-BLOCK-STRING-TEST_NAME> +as these methods are only aliases. If you want more than one test for carped warnings, try this: -C<warnings_are {carp "c1"; carp "c2"} {carped => ['c1','c2'];> or -C<warnings_are {foo()} ["Warning 1", {carped => ["Carp 1", "Carp 2"]}, "Warning 2"]>. -Note that C<{carped => ...}> must always be a hash ref. -=item warning_like BLOCK REGEXP, TEST_NAME + warnings_are {carp "c1"; carp "c2"} {carped => ['c1','c2']; + +or + + warnings_are {foo()} ["Warning 1", {carped => ["Carp 1", "Carp 2"]}, "Warning 2"]; + +Note that C<< {carped => ...} >> must always be a hash ref. + +=item B<warning_like> I<BLOCK REGEXP, TEST_NAME> Tests that BLOCK gives exactly one warning and it can be matched by the given regexp. -If the string is undef, -then the tests succeeds if the BLOCK doesn't give any warning. + +If the string is undef, then the tests succeeds if the BLOCK doesn't +give any warning. The REGEXP is matched against the whole warning line, -which in general has the form "WARNING at __FILE__ line __LINE__". -So you can check for a warning in the file Foo.pm on line 5 with -C<warning_like {bar()} qr/at Foo.pm line 5/, "Testname">. +which in general has the form C<< "WARNING at __FILE__ line __LINE__" >>. +So you can check for a warning in the file C<Foo.pm> on line 5 with: + + warning_like {bar()} qr/at Foo.pm line 5/, "Testname" + I don't know whether it makes sense to do such a test :-( -However, you should be prepared as a matching with 'at', 'file', '\d' -or similar will always pass. -Think to the qr/^foo/ if you want to test for warning "foo something" in file foo.pl. -You can also write the regexp in a string as "/.../" -instead of using the qr/.../ syntax. +However, you should be prepared as a matching with C<'at'>, C<'file'>, C<'\d'> +or similar will always pass. + +Consider C<< qr/^foo/ >> if you want to test for warning C<"foo something"> in file F<foo.pl>. + +You can also write the regexp in a string as C<"/.../"> +instead of using the C<< qr/.../ >> syntax. + Note that the slashes are important in the string, as strings without slashes are reserved for warning categories (to match warning categories as can be seen in the perllexwarn man page). -Similar to C<warning_is>, +Similar to +L<< C<warning_is()>|/warning_is-BLOCK-STRING-TEST_NAME >> and +L<< C<warnings_are()>|/warnings_are-BLOCK-ARRAYREF-TEST_NAME >> you can test for warnings via C<carp> with: -C<warning_like {bar()} {carped => qr/bar called too early/i};> -Similar to C<warning_is>/C<warnings_are>, -C<warning_like> and C<warnings_like> are only aliases to the same methods. + warning_like {bar()} {carped => qr/bar called too early/i}; + +Similar to +L<< C<warning_is()>|/warning_is-BLOCK-STRING-TEST_NAME >> and +L<< C<warnings_are()>|/warnings_are-BLOCK-ARRAYREF-TEST_NAME >>, + +L<< C<warning_like()>|/warning_like-BLOCK-REGEXP-TEST_NAME >> and +L<< C<warnings_like()>|/warnings_like-BLOCK-ARRAYREF-TEST_NAME >> +are only aliases to the same methods. A true value is returned if the test succeeds, false otherwise. The test name is optional, but recommended. -=item warning_like BLOCK STRING, TEST_NAME +=item B<warning_like> I<BLOCK STRING, TEST_NAME> Tests whether a BLOCK gives exactly one warning of the passed category. + The categories are grouped in a tree, -like it is expressed in perllexwarn. +like it is expressed in L<perllexwarn>. Also see L</BUGS AND LIMITATIONS>. Thanks to the grouping in a tree, -it's simple possible to test for an 'io' warning, -instead for testing for a 'closed|exec|layer|newline|pipe|unopened' warning. +it's possible to test simply for an 'io' warning, +instead of testing for a 'closed|exec|layer|newline|pipe|unopened' warning. -Note, that warnings occurring at compile time, +Note, that warnings occurring at compile time can only be caught in an eval block. So - warning_like {eval q/"$x"; $x;/} - [qw/void uninitialized/], - "some warnings at compile time"; + warning_like {eval q/"$x"; $x;/} + [qw/void uninitialized/], + "some warnings at compile time"; -will work, -while it wouldn't work without the eval. +will work, while it wouldn't work without the eval. Note, that it isn't possible yet, to test for own categories, -created with warnings::register. +created with L<warnings::register>. -=item warnings_like BLOCK ARRAYREF, TEST_NAME +=item B<warnings_like> I<BLOCK ARRAYREF, TEST_NAME> -Tests to see that BLOCK gives exactly the number of the specified warnings -and all the warnings have to match in the defined order to the -passed regexes. +Tests to see that BLOCK gives exactly the number of the specified +warnings, in the defined order. -Please read also the notes to warning_like as these methods are only aliases. +Please read also the notes to +L<< C<warning_like()>|/warning_like-BLOCK-REGEXP-TEST_NAME >> +as these methods are only aliases. -Similar to C<warnings_are>, +Similar to +L<< C<warnings_are()>|/warnings_are-BLOCK-ARRAYREF-TEST_NAME >>, you can test for multiple warnings via C<carp> and for warning categories, too: - warnings_like {foo()} + warnings_like {foo()} [qr/bar warning/, qr/bar warning/, {carped => qr/bar warning/i}, 'io' ], - "I hope, you'll never have to write a test for so many warnings :-)"; + "I hope you'll never have to write a test for so many warnings :-)"; -=item warnings_exist BLOCK STRING|ARRAYREF, TEST_NAME +=item B<warnings_exist> I<BLOCK STRING|ARRAYREF, TEST_NAME> -Same as warning_like, but will warn() all warnings that do not match the supplied regex/category, +Same as warning_like, but will C<< warn() >> all warnings that do not match the supplied regex/category, instead of registering an error. Use this test when you just want to make sure that specific warnings were generated, and couldn't care less if other warnings happened in the same block of code. @@ -188,39 +221,35 @@ =head1 BUGS AND LIMITATIONS -Category check is done as qr/category_name/. In some case this works, like for -category 'uninitialized'. For 'utf8' it does not work. Perl does not have a list -of warnings, so it is not possible to generate one for Test::Warn. +Category check is done as C<< qr/category_name/ >>. In some case this works, like for +category C<'uninitialized'>. For C<'utf8'> it does not work. Perl does not have a list +of warnings, so it is not possible to generate one for C<Test::Warn>. + If you want to add a warning to a category, send a pull request. Modifications -should be done to %warnings_in_category. You should look into perl source to check +should be done to C<< %warnings_in_category >>. You should look into perl source to check how warning is looking exactly. -Please note that warnings with newlines inside are making a lot of trouble. -The only sensible way to handle them is to use are the C<warning_like> or -C<warnings_like> methods. Background for these problems is that there is no -really secure way to distinguish between warnings with newlines and a tracing +Please note that warnings with newlines inside are very awkward. +The only sensible way to handle them is to use the C<warning_like> or +C<warnings_like> methods. The background is that there is no +really safe way to distinguish between warnings with newlines and a stacktrace. -If a method has it's own warn handler, +If a method has its own warn handler, overwriting C<$SIG{__WARN__}>, my test warning methods won't get these warnings. -The C<warning_like BLOCK CATEGORY, TEST_NAME> method isn't extremely tested. -Please use this calling style with higher attention and -tell me if you find a bug. - -=head1 TODO +The C<warning_like BLOCK CATEGORY, TEST_NAME> method isn't fully tested. +Please take note if you use this this calling style, +and report any bugs you find. -Improve this documentation. +=head2 XS warnings -The code has some parts doubled - especially in the test scripts. -This is really awkward and must be changed. - -Please feel free to suggest improvements. +As described in https://rt.cpan.org/Ticket/Display.html?id=42070&results=3c71d1b101a730e185691657f3b02f21 or https://github.com/hanfried/test-warn/issues/1 XS warnings might not be caught. =head1 SEE ALSO -Have a look to the similar modules: L<Test::Exception>, L<Test::Trap>. +Have a look to the similar L<Test::Exception> module. L<Test::Trap> =head1 THANKS @@ -237,8 +266,10 @@ Copyright 2007-2014 by Alexandr Ciornii, L<http://chorny.net/> +Copyright 2015-2018 by Janek Schleicher + This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself. +it under the same terms as Perl itself. =cut @@ -249,10 +280,9 @@ use strict; use warnings; -#use Array::Compare; use Sub::Uplevel 0.12; -our $VERSION = '0.32'; +our $VERSION = '0.35'; require Exporter; @@ -443,6 +473,9 @@ #!grep { $_ ne $warn_bits && ($_ & $warn_bits) eq $_ } values %$bits; } keys %$bits; +# Create a warning name category (e.g. 'utf8') to map to a list of warnings. +# The warnings are strings that will be OR'ed together into a +# regular expression: qr/...|...|.../. my %warnings_in_category = ( 'utf8' => ['Wide character in \w+\b',], ); @@ -453,7 +486,7 @@ my @category_warnings = grep { ($bits->{$_} & $category_bits) eq $bits->{$_} } @warnings; - my @list = + my @list = map { exists $warnings_in_category{$_}? (@{ $warnings_in_category{$_}}) : ($_) } @category_warnings; my $re = join "|", @list; @@ -462,10 +495,10 @@ sub warning_like_category { my ($warning, $category) = @_; - my $re = _warning_category_regexp($category) or + my $re = _warning_category_regexp($category) or carp("Unknown warning category '$category'"),return; my $ok = $warning =~ /$re/; return $ok; } - + 1;