r65454 - in /trunk/libmoosex-types-perl: ./ debian/ lib/MooseX/ lib/MooseX/Types/ t/ t/lib/ t/regressions/
ansgar at users.alioth.debian.org
ansgar at users.alioth.debian.org
Wed Dec 1 17:45:40 UTC 2010
Author: ansgar
Date: Wed Dec 1 17:45:30 2010
New Revision: 65454
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=65454
Log:
* New upstream release.
* Add build-dep on libtest-requires-perl.
* Build-depend on libtest-fatal-perl instead of libtest-exception-perl.
* Bump build-dep on libtest-simple-perl to >= 0.88.
Added:
trunk/libmoosex-types-perl/t/lib/Empty.pm
- copied unchanged from r65453, branches/upstream/libmoosex-types-perl/current/t/lib/Empty.pm
Modified:
trunk/libmoosex-types-perl/Changes
trunk/libmoosex-types-perl/MANIFEST
trunk/libmoosex-types-perl/META.yml
trunk/libmoosex-types-perl/Makefile.PL
trunk/libmoosex-types-perl/README
trunk/libmoosex-types-perl/debian/changelog
trunk/libmoosex-types-perl/debian/control
trunk/libmoosex-types-perl/lib/MooseX/Types.pm
trunk/libmoosex-types-perl/lib/MooseX/Types/Base.pm
trunk/libmoosex-types-perl/lib/MooseX/Types/CheckedUtilExports.pm
trunk/libmoosex-types-perl/lib/MooseX/Types/Combine.pm
trunk/libmoosex-types-perl/lib/MooseX/Types/Moose.pm
trunk/libmoosex-types-perl/lib/MooseX/Types/TypeDecorator.pm
trunk/libmoosex-types-perl/lib/MooseX/Types/UndefinedType.pm
trunk/libmoosex-types-perl/lib/MooseX/Types/Util.pm
trunk/libmoosex-types-perl/lib/MooseX/Types/Wrapper.pm
trunk/libmoosex-types-perl/t/10_moose-types.t
trunk/libmoosex-types-perl/t/11_library-definition.t
trunk/libmoosex-types-perl/t/12_wrapper-definition.t
trunk/libmoosex-types-perl/t/13_typedecorator.t
trunk/libmoosex-types-perl/t/14_compatibility-sub-exporter.t
trunk/libmoosex-types-perl/t/15_recursion.t
trunk/libmoosex-types-perl/t/16_introspection.t
trunk/libmoosex-types-perl/t/17_syntax_errors.t
trunk/libmoosex-types-perl/t/18_combined_libs.t
trunk/libmoosex-types-perl/t/19_typelib_with_role.t
trunk/libmoosex-types-perl/t/20_union_with_string_type.t
trunk/libmoosex-types-perl/t/21_coerce_parameterized_types.t
trunk/libmoosex-types-perl/t/regressions/01-is_subtype_of.t
Modified: trunk/libmoosex-types-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/Changes?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/Changes (original)
+++ trunk/libmoosex-types-perl/Changes Wed Dec 1 17:45:30 2010
@@ -1,4 +1,16 @@
Revision history for MooseX-Types
+
+0.25 Tue Nov 30 13:49:52 CST 2010
+ - The test suite now uses Test::Fatal instead of Test::Exception
+ (Karen Etheridge).
+ - Modernized tests to use Test::Requires and done_testing. (Dave
+ Rolsky)
+ - MooseX::Types::Combine is a little more efficient, and only tries to
+ load the libraries it's combining when that list is set. It also
+ checks that each lib in the list actually provides types. (Dave
+ Rolsky).
+ - The MooseX::Types docs now contain a pointer to
+ MooseX::Types::Combine. (Dave Rolsky)
0.24 Sat Sep 11 19:59:18 CEST 2010
- Avoid more warnings from Moose 1.09 in tests (Dave Rolsky).
Modified: trunk/libmoosex-types-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/MANIFEST?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/MANIFEST (original)
+++ trunk/libmoosex-types-perl/MANIFEST Wed Dec 1 17:45:30 2010
@@ -35,6 +35,7 @@
t/21_coerce_parameterized_types.t
t/lib/Combined.pm
t/lib/DecoratorLibrary.pm
+t/lib/Empty.pm
t/lib/IntrospectTypeExports.pm
t/lib/SubExporterCompatibility.pm
t/lib/TestLibrary.pm
Modified: trunk/libmoosex-types-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/META.yml?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/META.yml (original)
+++ trunk/libmoosex-types-perl/META.yml Wed Dec 1 17:45:30 2010
@@ -5,9 +5,10 @@
build_requires:
ExtUtils::MakeMaker: 6.42
FindBin: 0
- Test::Exception: 0
+ Test::Fatal: 0
Test::Moose: 0
- Test::More: 0.80
+ Test::More: 0.88
+ Test::Requires: 0
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module
@@ -24,31 +25,31 @@
provides:
MooseX::Types:
file: lib/MooseX/Types.pm
- version: 0.24
+ version: 0.25
MooseX::Types::Base:
file: lib/MooseX/Types/Base.pm
- version: 0.24
+ version: 0.25
MooseX::Types::CheckedUtilExports:
file: lib/MooseX/Types/CheckedUtilExports.pm
- version: 0.24
+ version: 0.25
MooseX::Types::Combine:
file: lib/MooseX/Types/Combine.pm
- version: 0.24
+ version: 0.25
MooseX::Types::Moose:
file: lib/MooseX/Types/Moose.pm
- version: 0.24
+ version: 0.25
MooseX::Types::TypeDecorator:
file: lib/MooseX/Types/TypeDecorator.pm
- version: 0.24
+ version: 0.25
MooseX::Types::UndefinedType:
file: lib/MooseX/Types/UndefinedType.pm
- version: 0.24
+ version: 0.25
MooseX::Types::Util:
file: lib/MooseX/Types/Util.pm
- version: 0.24
+ version: 0.25
MooseX::Types::Wrapper:
file: lib/MooseX/Types/Wrapper.pm
- version: 0.24
+ version: 0.25
requires:
Carp: 0
Carp::Clan: 6.00
@@ -60,4 +61,5 @@
perl: 5.8.0
resources:
license: http://dev.perl.org/licenses/
-version: 0.24
+version: 0.25
+x_authority: cpan:PHAYLON
Modified: trunk/libmoosex-types-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/Makefile.PL?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/Makefile.PL (original)
+++ trunk/libmoosex-types-perl/Makefile.PL Wed Dec 1 17:45:30 2010
@@ -9,10 +9,11 @@
author q{Robert "phaylon" Sedlacek <rs at 474.at>};
all_from q{lib/MooseX/Types.pm};
-build_requires q{Test::More}, '0.80';
+build_requires q{Test::More}, '0.88';
build_requires q{FindBin}, 0;
build_requires q{Test::Moose}, 0;
-build_requires q{Test::Exception}, 0;
+build_requires q{Test::Fatal}, 0;
+build_requires q{Test::Requires}, 0;
requires q{Moose}, '1.06';
requires q{Sub::Install}, '0.924';
@@ -21,6 +22,8 @@
requires q{Carp::Clan}, '6.00';
requires q{Scalar::Util}, '1.19';
requires q{Sub::Name}, 0;
+
+add_metadata( x_authority => 'cpan:PHAYLON' );
if (can_use('MooseX::Types::IO') && !can_use('MooseX::Types::IO', '0.03')) {
requires q{MooseX::Types::IO}, '0.03';
Modified: trunk/libmoosex-types-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/README?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/README (original)
+++ trunk/libmoosex-types-perl/README Wed Dec 1 17:45:30 2010
@@ -122,8 +122,8 @@
return a false value if the type could not be coerced.
Important Note: This handler will only be exported for types that can do
- type coercion. This has the advantage that a coercion to a type that
- cannot hasn't defined any coercions will lead to a compile-time error.
+ type coercion. This has the advantage that a coercion to a type that has
+ not defined any coercions will lead to a compile-time error.
LIBRARY DEFINITION
A MooseX::Types is just a normal Perl module. Unlike Moose itself, it
@@ -315,7 +315,7 @@
subtype StrOrArrayRef => as Str|ArrayRef;
- The 'StrOrArrayRef' will have it's stringification activated this causes
+ The 'StrOrArrayRef' will have its stringification activated this causes
the subtype to not be created. Since the bareword type constraints are
not strings you really should not try to treat them that way. You will
have to use the ',' operator instead. The author's of this package
@@ -361,6 +361,14 @@
type libraries. Patches and detailed test cases welcome. See the tests
directory for a start on this.
+COMBINING TYPE LIBRARIES
+ You may want to combine a set of types for your application with other
+ type libraries, like MooseX::Types::Moose or
+ MooseX::Types::Common::String.
+
+ The MooseX::Types::Combine module provides a simple API for combining a
+ set of type libraries together.
+
SEE ALSO
Moose, Moose::Util::TypeConstraints, MooseX::Types::Moose, Sub::Exporter
Modified: trunk/libmoosex-types-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/debian/changelog?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/debian/changelog (original)
+++ trunk/libmoosex-types-perl/debian/changelog Wed Dec 1 17:45:30 2010
@@ -1,12 +1,16 @@
-libmoosex-types-perl (0.24-2) UNRELEASED; urgency=low
+libmoosex-types-perl (0.25-1) unstable; urgency=low
[ Salvatore Bonaccorso ]
* Update my email address.
[ Ansgar Burchardt ]
+ * New upstream release.
+ * Add build-dep on libtest-requires-perl.
+ * Build-depend on libtest-fatal-perl instead of libtest-exception-perl.
+ * Bump build-dep on libtest-simple-perl to >= 0.88.
* Update my email address.
- -- Salvatore Bonaccorso <carnil at debian.org> Sun, 10 Oct 2010 15:03:16 +0200
+ -- Ansgar Burchardt <ansgar at debian.org> Wed, 01 Dec 2010 18:45:16 +0100
libmoosex-types-perl (0.24-1) unstable; urgency=low
Modified: trunk/libmoosex-types-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/debian/control?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/debian/control (original)
+++ trunk/libmoosex-types-perl/debian/control Wed Dec 1 17:45:30 2010
@@ -5,8 +5,8 @@
Build-Depends-Indep: libcarp-clan-perl, libclass-mop-perl,
libmoose-perl (>= 1.06), libnamespace-clean-perl,
libsub-exporter-perl, libsub-install-perl (>= 0.924), libsub-name-perl,
- libtest-exception-perl, perl,
- perl (>= 5.10.1) | libtest-simple-perl (>= 0.80)
+ libtest-fatal-perl, libtest-requires-perl, perl,
+ perl (>= 5.10.1) | libtest-simple-perl (>= 0.88)
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
Uploaders: Salvatore Bonaccorso <carnil at debian.org>,
Ansgar Burchardt <ansgar at debian.org>, Ryan Niebur <ryan at debian.org>,
Modified: trunk/libmoosex-types-perl/lib/MooseX/Types.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/lib/MooseX/Types.pm?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/lib/MooseX/Types.pm (original)
+++ trunk/libmoosex-types-perl/lib/MooseX/Types.pm Wed Dec 1 17:45:30 2010
@@ -20,7 +20,7 @@
use namespace::clean -except => [qw( meta )];
use 5.008;
-our $VERSION = '0.24';
+our $VERSION = '0.25';
my $UndefMsg = q{Action for type '%s' not yet defined in library '%s'};
=head1 SYNOPSIS
@@ -152,7 +152,7 @@
B<Important Note>: This handler will only be exported for types that can
do type coercion. This has the advantage that a coercion to a type that
-cannot hasn't defined any coercions will lead to a compile-time error.
+has not defined any coercions will lead to a compile-time error.
=head1 LIBRARY DEFINITION
@@ -527,7 +527,7 @@
subtype StrOrArrayRef => as Str|ArrayRef;
-The 'StrOrArrayRef' will have it's stringification activated this causes the
+The 'StrOrArrayRef' will have its stringification activated this causes the
subtype to not be created. Since the bareword type constraints are not strings
you really should not try to treat them that way. You will have to use the ','
operator instead. The author's of this package realize that all the L<Moose>
@@ -571,7 +571,15 @@
together. I realize this workaround will lead a lot of duplication in your
export declarations and will be onerous for large type libraries. Patches and
detailed test cases welcome. See the tests directory for a start on this.
-
+
+=head1 COMBINING TYPE LIBRARIES
+
+You may want to combine a set of types for your application with other type
+libraries, like L<MooseX::Types::Moose> or L<MooseX::Types::Common::String>.
+
+The L<MooseX::Types::Combine> module provides a simple API for combining a set
+of type libraries together.
+
=head1 SEE ALSO
L<Moose>,
Modified: trunk/libmoosex-types-perl/lib/MooseX/Types/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/lib/MooseX/Types/Base.pm?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/lib/MooseX/Types/Base.pm (original)
+++ trunk/libmoosex-types-perl/lib/MooseX/Types/Base.pm Wed Dec 1 17:45:30 2010
@@ -1,5 +1,5 @@
package MooseX::Types::Base;
-our $VERSION = "0.24";
+our $VERSION = "0.25";
use Moose;
=head1 NAME
Modified: trunk/libmoosex-types-perl/lib/MooseX/Types/CheckedUtilExports.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/lib/MooseX/Types/CheckedUtilExports.pm?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/lib/MooseX/Types/CheckedUtilExports.pm (original)
+++ trunk/libmoosex-types-perl/lib/MooseX/Types/CheckedUtilExports.pm Wed Dec 1 17:45:30 2010
@@ -6,7 +6,7 @@
=cut
package MooseX::Types::CheckedUtilExports;
-our $VERSION = "0.24";
+our $VERSION = "0.25";
use strict;
use warnings;
Modified: trunk/libmoosex-types-perl/lib/MooseX/Types/Combine.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/lib/MooseX/Types/Combine.pm?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/lib/MooseX/Types/Combine.pm (original)
+++ trunk/libmoosex-types-perl/lib/MooseX/Types/Combine.pm Wed Dec 1 17:45:30 2010
@@ -5,7 +5,7 @@
=cut
package MooseX::Types::Combine;
-our $VERSION = "0.24";
+our $VERSION = "0.25";
use strict;
use warnings;
@@ -36,20 +36,17 @@
my ($class, @types) = @_;
my $caller = caller;
- my @type_libs = $class->provide_types_from;
- Class::MOP::load_class($_) for @type_libs;
-
- my %types = map {
- my $lib = $_;
- map +($_ => $lib), $lib->type_names
- } @type_libs;
+ my %types = $class->_provided_types;
my %from;
for my $type (@types) {
- die
- "$caller asked for a type ($type) which is not found in any of the"
- . " type libraries (@type_libs) combined by $class\n"
- unless $types{$type};
+ unless ($types{$type}) {
+ my @type_libs = $class->provide_types_from;
+
+ die
+ "$caller asked for a type ($type) which is not found in any of the"
+ . " type libraries (@type_libs) combined by $class\n";
+ }
push @{ $from{ $types{$type} } }, $type;
}
@@ -72,9 +69,40 @@
my $store =
do { no strict 'refs'; \@{ "${class}::__MOOSEX_TYPELIBRARY_LIBRARIES" } };
- @$store = @libs if @libs;
+ if (@libs) {
+ $class->_check_type_lib($_) for @libs;
+ @$store = @libs;
+
+ my %types = map {
+ my $lib = $_;
+ map +( $_ => $lib ), $lib->type_names
+ } @libs;
+
+ $class->_provided_types(%types);
+ }
@$store;
+}
+
+sub _check_type_lib {
+ my ($class, $lib) = @_;
+
+ Class::MOP::load_class($lib);
+
+ die "Cannot use $lib in a combined type library, it does not provide any types"
+ unless $lib->can('type_names');
+}
+
+sub _provided_types {
+ my ($class, %types) = @_;
+
+ my $types =
+ do { no strict 'refs'; \%{ "${class}::__MOOSEX_TYPELIBRARY_TYPES" } };
+
+ %$types = %types
+ if keys %types;
+
+ %$types;
}
=head1 SEE ALSO
Modified: trunk/libmoosex-types-perl/lib/MooseX/Types/Moose.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/lib/MooseX/Types/Moose.pm?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/lib/MooseX/Types/Moose.pm (original)
+++ trunk/libmoosex-types-perl/lib/MooseX/Types/Moose.pm Wed Dec 1 17:45:30 2010
@@ -1,5 +1,5 @@
package MooseX::Types::Moose;
-our $VERSION = "0.24";
+our $VERSION = "0.25";
=head1 NAME
Modified: trunk/libmoosex-types-perl/lib/MooseX/Types/TypeDecorator.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/lib/MooseX/Types/TypeDecorator.pm?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/lib/MooseX/Types/TypeDecorator.pm (original)
+++ trunk/libmoosex-types-perl/lib/MooseX/Types/TypeDecorator.pm Wed Dec 1 17:45:30 2010
@@ -1,5 +1,5 @@
package MooseX::Types::TypeDecorator;
-our $VERSION = "0.24";
+our $VERSION = "0.25";
use strict;
use warnings;
Modified: trunk/libmoosex-types-perl/lib/MooseX/Types/UndefinedType.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/lib/MooseX/Types/UndefinedType.pm?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/lib/MooseX/Types/UndefinedType.pm (original)
+++ trunk/libmoosex-types-perl/lib/MooseX/Types/UndefinedType.pm Wed Dec 1 17:45:30 2010
@@ -1,5 +1,5 @@
package MooseX::Types::UndefinedType;
-our $VERSION = "0.24";
+our $VERSION = "0.25";
=head1 NAME
Modified: trunk/libmoosex-types-perl/lib/MooseX/Types/Util.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/lib/MooseX/Types/Util.pm?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/lib/MooseX/Types/Util.pm (original)
+++ trunk/libmoosex-types-perl/lib/MooseX/Types/Util.pm Wed Dec 1 17:45:30 2010
@@ -1,5 +1,5 @@
package MooseX::Types::Util;
-our $VERSION = "0.24";
+our $VERSION = "0.25";
=head1 NAME
Modified: trunk/libmoosex-types-perl/lib/MooseX/Types/Wrapper.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/lib/MooseX/Types/Wrapper.pm?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/lib/MooseX/Types/Wrapper.pm (original)
+++ trunk/libmoosex-types-perl/lib/MooseX/Types/Wrapper.pm Wed Dec 1 17:45:30 2010
@@ -5,7 +5,7 @@
=cut
package MooseX::Types::Wrapper;
-our $VERSION = "0.24";
+our $VERSION = "0.25";
use Moose;
use Carp::Clan qw( ^MooseX::Types );
Modified: trunk/libmoosex-types-perl/t/10_moose-types.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/t/10_moose-types.t?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/t/10_moose-types.t (original)
+++ trunk/libmoosex-types-perl/t/10_moose-types.t Wed Dec 1 17:45:30 2010
@@ -8,8 +8,6 @@
use MooseX::Types::Moose ':all', 'Bool';
my @types = MooseX::Types::Moose->type_names;
-
-plan tests => @types * 3;
for my $t (@types) {
ok my $code = __PACKAGE__->can($t), "$t() was exported";
@@ -22,3 +20,4 @@
ok __PACKAGE__->can("is_$t"), "is_$t() was exported";
}
+done_testing;
Modified: trunk/libmoosex-types-perl/t/11_library-definition.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/t/11_library-definition.t?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/t/11_library-definition.t (original)
+++ trunk/libmoosex-types-perl/t/11_library-definition.t Wed Dec 1 17:45:30 2010
@@ -12,8 +12,6 @@
[ 'NonEmptyStr', 12, "12", [], "foobar", "" ],
[ 'IntArrayRef', 12, [12], {}, [17, 23], {} ],
);
-
-plan tests => (@tests * 8) + 5;
# new array ref so we can safely shift from it
for my $data (map { [@$_] } @tests) {
@@ -52,3 +50,5 @@
eval { require TestNamespaceSep };
ok $@, q(trying to declare a type with '::' in it croaks);
like $@, qr/Foo::Bar/, q(error message contains type name);
+
+done_testing;
Modified: trunk/libmoosex-types-perl/t/12_wrapper-definition.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/t/12_wrapper-definition.t?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/t/12_wrapper-definition.t (original)
+++ trunk/libmoosex-types-perl/t/12_wrapper-definition.t Wed Dec 1 17:45:30 2010
@@ -16,8 +16,6 @@
[ 'IntArrayRef', 'TestLibrary::IntArrayRef', 12, [12], {}, [17, 23], {} ],
[ 'Str', 'Str', 12, "12", [], "foo", [777] ],
);
-
-plan tests => (@tests * 9);
# new array ref so we can safely shift from it
for my $data (map { [@$_] } @tests) {
@@ -49,4 +47,4 @@
}
}
-
+done_testing;
Modified: trunk/libmoosex-types-perl/t/13_typedecorator.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/t/13_typedecorator.t?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/t/13_typedecorator.t (original)
+++ trunk/libmoosex-types-perl/t/13_typedecorator.t Wed Dec 1 17:45:30 2010
@@ -2,8 +2,8 @@
use warnings;
use strict;
-use Test::More tests => 62;
-use Test::Exception;
+use Test::More;
+use Test::Fatal;
use FindBin;
use lib "$FindBin::Bin/lib";
@@ -77,7 +77,7 @@
is_deeply $type->arrayrefint01, [qw(7 8)],
=> 'Assignment and coercion is correct';
-throws_ok sub {
+like exception {
$type->arrayrefint01([qw(a b c)])
}, qr/Attribute \(arrayrefint01\) does not pass the type constraint/ => 'Dies when values are strings';
@@ -121,7 +121,7 @@
is_deeply $type->arrayrefint03, [qw(11 12 13)],
=> 'Assignment is correct';
-throws_ok sub {
+like exception {
$type->arrayrefint03([qw(a b c)])
}, qr/Attribute \(arrayrefint03\) does not pass the type constraint/ => 'Dies when values are strings';
@@ -133,7 +133,7 @@
ok $type->StrOrArrayRef_attr([1,2,3])
=> 'arrayref part of union is good';
-throws_ok sub {
+like exception {
$type->StrOrArrayRef_attr({a=>111});
}, qr/Attribute \(StrOrArrayRef_attr\) does not pass the type constraint/ => 'Correctly failed to use a hashref';
@@ -145,11 +145,11 @@
is_deeply $type->AtLeastOneInt_attr, [1,2]
=> "Got expected values.";
-throws_ok sub {
+like exception {
$type->AtLeastOneInt_attr([]);
}, qr/Attribute \(AtLeastOneInt_attr\) does not pass the type constraint/ => 'properly fails to assign as []';
-throws_ok sub {
+like exception {
$type->AtLeastOneInt_attr(['a','b']);
}, qr/Attribute \(AtLeastOneInt_attr\) does not pass the type constraint/ => 'properly fails arrayref of strings';
@@ -161,7 +161,7 @@
ok $type->pipeoverloading('a')
=> 'String for union test accepted';
-throws_ok sub {
+like exception {
$type->pipeoverloading({a=>1,b=>2});
}, qr/Validation failed for 'Int|Str'/ => 'Union test corrected fails a HashRef';
@@ -173,7 +173,7 @@
is_deeply $type->deep, [[{a=>1,b=>2},{c=>3,d=>4}],[{e=>5}]],
=> 'Assignment is correct';
-throws_ok sub {
+like exception {
$type->deep({a=>1,b=>2});
}, qr/Attribute \(deep\) does not pass the type constraint/ => 'Deep Constraints properly fail';
@@ -185,11 +185,11 @@
is_deeply $type->deep2, [[{a=>1,b=>2},{c=>3,d=>4}],[{e=>5}]],
=> 'Assignment is correct';
-throws_ok sub {
+like exception {
$type->deep2({a=>1,b=>2});
}, qr/Attribute \(deep2\) does not pass the type constraint/ => 'Deep Constraints properly fail';
-throws_ok sub {
+like exception {
$type->deep2([[{a=>1,b=>2},{c=>3,d=>'noway'}],[{e=>5}]]);
}, qr/Attribute \(deep2\) does not pass the type constraint/ => 'Deep Constraints properly fail';
@@ -214,7 +214,7 @@
=> 'Good Assignment of Programming to Enum';
-throws_ok sub {
+like exception {
$type->enum('ddddd');
}, qr/Attribute \(enum\) does not pass the type constraint/ => 'Enum properly fails';
@@ -226,7 +226,7 @@
is_deeply $type->SubOfMyArrayRefInt01_attr, [15,20,25],
=> 'Assignment is correct';
-throws_ok sub {
+like exception {
$type->SubOfMyArrayRefInt01_attr([15,5,20]);
}, qr/Attribute \(SubOfMyArrayRefInt01_attr\) does not pass the type constraint/
=> 'SubOfMyArrayRefInt01 Constraints properly fail';
@@ -239,17 +239,17 @@
is_deeply $type->WierdIntergersArrayRef1_attr, [5,10,1000],
=> 'Assignment is correct';
-throws_ok sub {
+like exception {
$type->WierdIntergersArrayRef1_attr({a=>1,b=>2});
}, qr/Attribute \(WierdIntergersArrayRef1_attr\) does not pass the type constraint/
=> 'Constraints properly fail';
-throws_ok sub {
+like exception {
$type->WierdIntergersArrayRef1_attr([5,10,1]);
}, qr/Attribute \(WierdIntergersArrayRef1_attr\) does not pass the type constraint/
=> 'Constraints properly fail';
-throws_ok sub {
+like exception {
$type->WierdIntergersArrayRef1_attr([1]);
}, qr/Attribute \(WierdIntergersArrayRef1_attr\) does not pass the type constraint/
=> 'Constraints properly fail';
@@ -262,21 +262,19 @@
is_deeply $type->WierdIntergersArrayRef2_attr, [5,10,$type],
=> 'Assignment is correct';
-throws_ok sub {
+like exception {
$type->WierdIntergersArrayRef2_attr({a=>1,b=>2});
}, qr/Attribute \(WierdIntergersArrayRef2_attr\) does not pass the type constraint/
=> 'Constraints properly fail';
-throws_ok sub {
+like exception {
$type->WierdIntergersArrayRef2_attr([5,10,1]);
}, qr/Attribute \(WierdIntergersArrayRef2_attr\) does not pass the type constraint/
=> 'Constraints properly fail';
-throws_ok sub {
+like exception {
$type->WierdIntergersArrayRef2_attr([1]);
}, qr/Attribute \(WierdIntergersArrayRef2_attr\) does not pass the type constraint/
=> 'Constraints properly fail';
-
-
-
+done_testing();
Modified: trunk/libmoosex-types-perl/t/14_compatibility-sub-exporter.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/t/14_compatibility-sub-exporter.t?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/t/14_compatibility-sub-exporter.t (original)
+++ trunk/libmoosex-types-perl/t/14_compatibility-sub-exporter.t Wed Dec 1 17:45:30 2010
@@ -2,18 +2,16 @@
use strict;
use warnings;
use Test::More;
- use Test::Exception;
use FindBin;
use lib "$FindBin::Bin/lib";
- eval "use Sub::Exporter";
- plan $@
- ? ( skip_all => "Tests require Sub::Exporter" )
- : ( tests => 3 );
+ use Test::Requires { 'Sub::Exporter' => '0' };
}
use SubExporterCompatibility qw(MyStr something);
ok MyStr->check('aaa'), "Correctly passed";
ok !MyStr->check([1]), "Correctly fails";
-ok something(), "Found the something method";
+ok something(), "Found the something method";
+
+done_testing;
Modified: trunk/libmoosex-types-perl/t/15_recursion.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/t/15_recursion.t?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/t/15_recursion.t (original)
+++ trunk/libmoosex-types-perl/t/15_recursion.t Wed Dec 1 17:45:30 2010
@@ -20,8 +20,7 @@
package MooseX::Types::Test::Recursion::TestRunner;
BEGIN {
- use Test::More tests=>5;
- use Test::Exception;
+ use Test::More;
## Grab the newly created test type constraint
MooseX::Types::Test::Recursion->import(':all');
@@ -49,10 +48,6 @@
ok ! RecursiveHashRef->check({key=>{subkey=>"value",subkey2=>{ssubkey=>[1,2,3]}}})
=> 'Properly invalidates bad value deeply';
+
+ done_testing;
}
-
-
-
-
-
-
Modified: trunk/libmoosex-types-perl/t/16_introspection.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/t/16_introspection.t?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/t/16_introspection.t (original)
+++ trunk/libmoosex-types-perl/t/16_introspection.t Wed Dec 1 17:45:30 2010
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More;
use FindBin;
use lib "$FindBin::Bin/lib";
@@ -56,3 +56,4 @@
], 'all calls to has_available_type_export returned correct results');
+done_testing();
Modified: trunk/libmoosex-types-perl/t/17_syntax_errors.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/t/17_syntax_errors.t?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/t/17_syntax_errors.t (original)
+++ trunk/libmoosex-types-perl/t/17_syntax_errors.t Wed Dec 1 17:45:30 2010
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 5;
+use Test::More;
# remove this when CheckedUtilExports croaks instead of carps
$SIG{__WARN__} = sub { die @_ };
@@ -91,3 +91,5 @@
};
eval $role_type;
is $@, '', "declared role_types don't throw error";
+
+done_testing();
Modified: trunk/libmoosex-types-perl/t/18_combined_libs.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/t/18_combined_libs.t?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/t/18_combined_libs.t (original)
+++ trunk/libmoosex-types-perl/t/18_combined_libs.t Wed Dec 1 17:45:30 2010
@@ -2,10 +2,10 @@
use strict;
use warnings;
use FindBin;
-use lib "$FindBin::Bin/lib";
+use lib "$FindBin::Bin/lib";
-use Test::More tests => 5;
-use Test::Exception;
+use Test::More;
+use Test::Fatal;
BEGIN { use_ok 'Combined', qw/Foo2Alias MTFNPY NonEmptyStr/ }
@@ -18,6 +18,22 @@
is NonEmptyStr->name, 'TestLibrary2::NonEmptyStr',
'precedence for conflicting types is correct';
-throws_ok { Combined->import('NonExistentType') }
+like exception { Combined->import('NonExistentType') },
qr/\Qmain asked for a type (NonExistentType) which is not found in any of the type libraries (TestLibrary TestLibrary2) combined by Combined/,
'asking for a non-existent type from a combined type library gives a useful error';
+
+{
+ package BadCombined;
+
+ use base 'MooseX::Types::Combine';
+
+ ::like ::exception { __PACKAGE__->provide_types_from('Empty') },
+ qr/Cannot use Empty in a combined type library, it does not provide any types/,
+ 'cannot combine types from a package which is not a type library';
+
+ ::like ::exception { __PACKAGE__->provide_types_from('DoesNotExist') },
+ qr/Can't locate DoesNotExist\.pm/,
+ 'cannot combine types from a package which does not exist';
+}
+
+done_testing();
Modified: trunk/libmoosex-types-perl/t/19_typelib_with_role.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/t/19_typelib_with_role.t?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/t/19_typelib_with_role.t (original)
+++ trunk/libmoosex-types-perl/t/19_typelib_with_role.t Wed Dec 1 17:45:30 2010
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
{
package MyRole;
@@ -24,3 +24,5 @@
};
ok !$@, 'type export not picked up as a method on role application';
+
+done_testing();
Modified: trunk/libmoosex-types-perl/t/20_union_with_string_type.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/t/20_union_with_string_type.t?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/t/20_union_with_string_type.t (original)
+++ trunk/libmoosex-types-perl/t/20_union_with_string_type.t Wed Dec 1 17:45:30 2010
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More;
my $exception;
{
@@ -48,3 +48,5 @@
Test::More::ok !Test3->check({a=>1}), 'fails wrong ref type';
Test::More::ok Test3->check($obj), 'Union allows Object';
}
+
+done_testing();
Modified: trunk/libmoosex-types-perl/t/21_coerce_parameterized_types.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/t/21_coerce_parameterized_types.t?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/t/21_coerce_parameterized_types.t (original)
+++ trunk/libmoosex-types-perl/t/21_coerce_parameterized_types.t Wed Dec 1 17:45:30 2010
@@ -1,9 +1,8 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::Exception;
-use Test::More tests => 2;
+use Test::More;
BEGIN {
package TypeLib;
@@ -47,3 +46,4 @@
::ok( $subtype->has_coercion, 'coercion applied to subtype' );
}
+done_testing();
Modified: trunk/libmoosex-types-perl/t/regressions/01-is_subtype_of.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmoosex-types-perl/t/regressions/01-is_subtype_of.t?rev=65454&op=diff
==============================================================================
--- trunk/libmoosex-types-perl/t/regressions/01-is_subtype_of.t (original)
+++ trunk/libmoosex-types-perl/t/regressions/01-is_subtype_of.t Wed Dec 1 17:45:30 2010
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More tests=>5;
+use Test::More;
use MooseX::Types;
use MooseX::Types::Moose qw(Any Item );
@@ -20,3 +20,4 @@
ok ( Item->is_subtype_of(Any),
q[Item is subtype of Any]);
+done_testing;
More information about the Pkg-perl-cvs-commits
mailing list