r62545 - in /branches/upstream/libtest-most-perl/current: Changes MANIFEST META.yml Makefile.PL lib/Test/Most.pm lib/Test/Most/Exception.pm t/exclude_test_symbols.t
carnil-guest at users.alioth.debian.org
carnil-guest at users.alioth.debian.org
Mon Sep 13 20:09:20 UTC 2010
Author: carnil-guest
Date: Mon Sep 13 20:08:47 2010
New Revision: 62545
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=62545
Log:
[svn-upgrade] new version libtest-most-perl (0.23)
Added:
branches/upstream/libtest-most-perl/current/t/exclude_test_symbols.t
Modified:
branches/upstream/libtest-most-perl/current/Changes
branches/upstream/libtest-most-perl/current/MANIFEST
branches/upstream/libtest-most-perl/current/META.yml
branches/upstream/libtest-most-perl/current/Makefile.PL
branches/upstream/libtest-most-perl/current/lib/Test/Most.pm
branches/upstream/libtest-most-perl/current/lib/Test/Most/Exception.pm
Modified: branches/upstream/libtest-most-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-most-perl/current/Changes?rev=62545&op=diff
==============================================================================
--- branches/upstream/libtest-most-perl/current/Changes (original)
+++ branches/upstream/libtest-most-perl/current/Changes Mon Sep 13 20:08:47 2010
@@ -1,4 +1,7 @@
Revision history for Test::Most
+
+0.23 2010-09-08
+ - added "Excluding Test Symbols" feature (RT#61146, Karen Etheridge).
0.22 2010-08-07
- Added always_explain() and always_show().
Modified: branches/upstream/libtest-most-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-most-perl/current/MANIFEST?rev=62545&op=diff
==============================================================================
--- branches/upstream/libtest-most-perl/current/MANIFEST (original)
+++ branches/upstream/libtest-most-perl/current/MANIFEST Mon Sep 13 20:08:47 2010
@@ -13,6 +13,7 @@
t/env_die.t
t/exception.t
t/exclude_test_modules.t
+t/exclude_test_symbols.t
t/explain.t
t/function_bail.t
t/function_die.t
Modified: branches/upstream/libtest-most-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-most-perl/current/META.yml?rev=62545&op=diff
==============================================================================
--- branches/upstream/libtest-most-perl/current/META.yml (original)
+++ branches/upstream/libtest-most-perl/current/META.yml Mon Sep 13 20:08:47 2010
@@ -13,10 +13,10 @@
provides:
Test::Most:
file: lib/Test/Most.pm
- version: 0.22
+ version: 0.23
Test::Most::Exception:
file: lib/Test/Most/Exception.pm
- version: 0.22
+ version: 0.23
recommends:
Data::Dumper::Names: 0.03
requires:
@@ -31,4 +31,4 @@
resources:
license: http://dev.perl.org/licenses/
repository: http://github.com/Ovid/test--most
-version: 0.22
+version: 0.23
Modified: branches/upstream/libtest-most-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-most-perl/current/Makefile.PL?rev=62545&op=diff
==============================================================================
--- branches/upstream/libtest-most-perl/current/Makefile.PL (original)
+++ branches/upstream/libtest-most-perl/current/Makefile.PL Mon Sep 13 20:08:47 2010
@@ -3,19 +3,19 @@
use ExtUtils::MakeMaker;
WriteMakefile
(
- 'PL_FILES' => {},
- 'INSTALLDIRS' => 'site',
- 'NAME' => 'Test::Most',
- 'EXE_FILES' => [],
- 'VERSION_FROM' => 'lib/Test/Most.pm',
- 'PREREQ_PM' => {
- 'Test::Harness' => '3.07',
- 'Test::Exception' => '0.29',
- 'Exception::Class' => '1.14',
- 'Test::More' => '0.88',
- 'Test::Differences' => '0.500',
- 'Test::Warn' => '0.11',
- 'Test::Deep' => '0.106'
- }
-)
+ 'NAME' => 'Test::Most',
+ 'VERSION_FROM' => 'lib/Test/Most.pm',
+ 'PREREQ_PM' => {
+ 'Exception::Class' => '1.14',
+ 'Test::Deep' => '0.106',
+ 'Test::Differences' => '0.500',
+ 'Test::Exception' => '0.29',
+ 'Test::Harness' => '3.07',
+ 'Test::More' => '0.88',
+ 'Test::Warn' => '0.11'
+ },
+ 'INSTALLDIRS' => 'site',
+ 'EXE_FILES' => [],
+ 'PL_FILES' => {}
+ )
;
Modified: branches/upstream/libtest-most-perl/current/lib/Test/Most.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-most-perl/current/lib/Test/Most.pm?rev=62545&op=diff
==============================================================================
--- branches/upstream/libtest-most-perl/current/lib/Test/Most.pm (original)
+++ branches/upstream/libtest-most-perl/current/lib/Test/Most.pm Mon Sep 13 20:08:47 2010
@@ -34,7 +34,7 @@
=cut
-our $VERSION = '0.22';
+our $VERSION = '0.23';
$VERSION = eval $VERSION;
=head1 SYNOPSIS
@@ -288,7 +288,7 @@
=head1 MISCELLANEOUS
-=head1 Excluding Test Modules
+=head2 Excluding Test Modules
Sometimes you want a exclude a particular test module. For example,
L<Test::Deep>, when used with L<Moose>, produces the following warning:
@@ -303,6 +303,15 @@
See
L<https://rt.cpan.org/Ticket/Display.html?id=54362&results=e73ff63c5bf9ba0f796efdba5773cf3f>
for more information.
+
+=head2 Excluding Test Symbols
+
+Sometimes you don't want to exclude an entire test module, but just a
+particular symbol that is causing issues (e.g. see the 'blessed' example
+above). You can exclude the symbol(s) in the standard way, by specifying the
+symbol in the import list with a '!' in front:
+
+ use Test::Most tests => 42, '!blessed';
=head2 Deferred plans
@@ -433,6 +442,8 @@
last;
}
}
+
+ my @exclude_symbols;
my $i = 0;
while ($i < @_) {
if ( !$bail_set and ( 'die' eq $_[$i] ) ) {
@@ -452,6 +463,12 @@
$i = 0;
next;
}
+ if ( $_[$i] =~ /^!(.*)/ ) {
+ splice @_, $i, 1;
+ push @exclude_symbols => $1;
+ $i = 0;
+ next;
+ }
if ( 'defer_plan' eq $_[$i] ) {
splice @_, $i, 1;
@@ -466,13 +483,24 @@
$i++;
}
foreach my $module (keys %modules_to_load) {
- eval "use $module";
- no strict 'refs';
- push @EXPORT => @{"${module}::EXPORT"};
+ # some Test modules we use are naughty and don't use Exporter.
+ # See RT#61145.
+ if ($module->isa('Exporter')) {
+ my $exclude_symbols = 'qw(' . join(' ', map { '!' . $_ } @exclude_symbols) . ')';
+ eval "require $module; import $module $exclude_symbols;";
+ } else {
+ eval "use $module";
+ }
+
if ( my $error = $@) {
require Carp;
Carp::croak($error);
}
+ no strict 'refs';
+ my %count;
+ $count{$_}++ foreach @{"${module}::EXPORT"}, @exclude_symbols;
+ # Note: export_to_level would be better here.
+ push @EXPORT => grep { $count{$_} == 1 } @{"${module}::EXPORT"};
}
# 'magic' goto to avoid updating the callstack
Modified: branches/upstream/libtest-most-perl/current/lib/Test/Most/Exception.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-most-perl/current/lib/Test/Most/Exception.pm?rev=62545&op=diff
==============================================================================
--- branches/upstream/libtest-most-perl/current/lib/Test/Most/Exception.pm (original)
+++ branches/upstream/libtest-most-perl/current/lib/Test/Most/Exception.pm Mon Sep 13 20:08:47 2010
@@ -16,7 +16,7 @@
=cut
-our $VERSION = '0.22';
+our $VERSION = '0.23';
$VERSION = eval $VERSION;
=head1 SYNOPSIS
Added: branches/upstream/libtest-most-perl/current/t/exclude_test_symbols.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtest-most-perl/current/t/exclude_test_symbols.t?rev=62545&op=file
==============================================================================
--- branches/upstream/libtest-most-perl/current/t/exclude_test_symbols.t (added)
+++ branches/upstream/libtest-most-perl/current/t/exclude_test_symbols.t Mon Sep 13 20:08:47 2010
@@ -1,0 +1,25 @@
+#!/usr/bin/perl
+
+use lib 'lib', 't/lib';
+
+BEGIN {
+ package t::Fake;
+ use Exporter 'import';
+ our @EXPORT = 'any';
+ our @EXPORT_OK = 'any';
+ $INC{'t/Fake.pm'} => 1;
+ # Test::Deep's any() returns a Test::Deep::Any object
+ sub any { 1; }
+}
+
+use Test::Most tests => 5, '!any';
+use OurTester qw($DIED dies);
+t::Fake->import;
+
+ok 1, 'Normal calls to ok() should succeed';
+is 2, 2, '... as should all passing tests';
+cmp_deeply [ 3, 4 ], [ 3, 4 ], '... and Test::Deep tests';
+ok !ref(any('foo')), "... but any() calls our version, not Test::Deep's";
+
+ok !(grep { $_ eq 'any' } @Test::Most::EXPORT), 'and "any" is not in our @EXPORT';
+
More information about the Pkg-perl-cvs-commits
mailing list