r65452 - in /branches/upstream/libmoosex-types-perl/current: ./ 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:41:08 UTC 2010
Author: ansgar
Date: Wed Dec 1 17:40:52 2010
New Revision: 65452
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=65452
Log:
[svn-upgrade] new version libmoosex-types-perl (0.25)
Added:
branches/upstream/libmoosex-types-perl/current/t/lib/Empty.pm
Modified:
branches/upstream/libmoosex-types-perl/current/Changes
branches/upstream/libmoosex-types-perl/current/MANIFEST
branches/upstream/libmoosex-types-perl/current/META.yml
branches/upstream/libmoosex-types-perl/current/Makefile.PL
branches/upstream/libmoosex-types-perl/current/README
branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types.pm
branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Base.pm
branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/CheckedUtilExports.pm
branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Combine.pm
branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Moose.pm
branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/TypeDecorator.pm
branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/UndefinedType.pm
branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Util.pm
branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Wrapper.pm
branches/upstream/libmoosex-types-perl/current/t/10_moose-types.t
branches/upstream/libmoosex-types-perl/current/t/11_library-definition.t
branches/upstream/libmoosex-types-perl/current/t/12_wrapper-definition.t
branches/upstream/libmoosex-types-perl/current/t/13_typedecorator.t
branches/upstream/libmoosex-types-perl/current/t/14_compatibility-sub-exporter.t
branches/upstream/libmoosex-types-perl/current/t/15_recursion.t
branches/upstream/libmoosex-types-perl/current/t/16_introspection.t
branches/upstream/libmoosex-types-perl/current/t/17_syntax_errors.t
branches/upstream/libmoosex-types-perl/current/t/18_combined_libs.t
branches/upstream/libmoosex-types-perl/current/t/19_typelib_with_role.t
branches/upstream/libmoosex-types-perl/current/t/20_union_with_string_type.t
branches/upstream/libmoosex-types-perl/current/t/21_coerce_parameterized_types.t
branches/upstream/libmoosex-types-perl/current/t/regressions/01-is_subtype_of.t
Modified: branches/upstream/libmoosex-types-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/Changes?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/Changes (original)
+++ branches/upstream/libmoosex-types-perl/current/Changes Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/MANIFEST?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/MANIFEST (original)
+++ branches/upstream/libmoosex-types-perl/current/MANIFEST Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/META.yml?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/META.yml (original)
+++ branches/upstream/libmoosex-types-perl/current/META.yml Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/Makefile.PL?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/Makefile.PL (original)
+++ branches/upstream/libmoosex-types-perl/current/Makefile.PL Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/README?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/README (original)
+++ branches/upstream/libmoosex-types-perl/current/README Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types.pm?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types.pm (original)
+++ branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types.pm Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Base.pm?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Base.pm (original)
+++ branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Base.pm Wed Dec 1 17:40:52 2010
@@ -1,5 +1,5 @@
package MooseX::Types::Base;
-our $VERSION = "0.24";
+our $VERSION = "0.25";
use Moose;
=head1 NAME
Modified: branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/CheckedUtilExports.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/CheckedUtilExports.pm?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/CheckedUtilExports.pm (original)
+++ branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/CheckedUtilExports.pm Wed Dec 1 17:40:52 2010
@@ -6,7 +6,7 @@
=cut
package MooseX::Types::CheckedUtilExports;
-our $VERSION = "0.24";
+our $VERSION = "0.25";
use strict;
use warnings;
Modified: branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Combine.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Combine.pm?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Combine.pm (original)
+++ branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Combine.pm Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Moose.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Moose.pm?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Moose.pm (original)
+++ branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Moose.pm Wed Dec 1 17:40:52 2010
@@ -1,5 +1,5 @@
package MooseX::Types::Moose;
-our $VERSION = "0.24";
+our $VERSION = "0.25";
=head1 NAME
Modified: branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/TypeDecorator.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/TypeDecorator.pm?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/TypeDecorator.pm (original)
+++ branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/TypeDecorator.pm Wed Dec 1 17:40:52 2010
@@ -1,5 +1,5 @@
package MooseX::Types::TypeDecorator;
-our $VERSION = "0.24";
+our $VERSION = "0.25";
use strict;
use warnings;
Modified: branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/UndefinedType.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/UndefinedType.pm?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/UndefinedType.pm (original)
+++ branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/UndefinedType.pm Wed Dec 1 17:40:52 2010
@@ -1,5 +1,5 @@
package MooseX::Types::UndefinedType;
-our $VERSION = "0.24";
+our $VERSION = "0.25";
=head1 NAME
Modified: branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Util.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Util.pm?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Util.pm (original)
+++ branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Util.pm Wed Dec 1 17:40:52 2010
@@ -1,5 +1,5 @@
package MooseX::Types::Util;
-our $VERSION = "0.24";
+our $VERSION = "0.25";
=head1 NAME
Modified: branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Wrapper.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Wrapper.pm?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Wrapper.pm (original)
+++ branches/upstream/libmoosex-types-perl/current/lib/MooseX/Types/Wrapper.pm Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/t/10_moose-types.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/t/10_moose-types.t?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/t/10_moose-types.t (original)
+++ branches/upstream/libmoosex-types-perl/current/t/10_moose-types.t Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/t/11_library-definition.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/t/11_library-definition.t?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/t/11_library-definition.t (original)
+++ branches/upstream/libmoosex-types-perl/current/t/11_library-definition.t Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/t/12_wrapper-definition.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/t/12_wrapper-definition.t?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/t/12_wrapper-definition.t (original)
+++ branches/upstream/libmoosex-types-perl/current/t/12_wrapper-definition.t Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/t/13_typedecorator.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/t/13_typedecorator.t?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/t/13_typedecorator.t (original)
+++ branches/upstream/libmoosex-types-perl/current/t/13_typedecorator.t Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/t/14_compatibility-sub-exporter.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/t/14_compatibility-sub-exporter.t?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/t/14_compatibility-sub-exporter.t (original)
+++ branches/upstream/libmoosex-types-perl/current/t/14_compatibility-sub-exporter.t Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/t/15_recursion.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/t/15_recursion.t?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/t/15_recursion.t (original)
+++ branches/upstream/libmoosex-types-perl/current/t/15_recursion.t Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/t/16_introspection.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/t/16_introspection.t?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/t/16_introspection.t (original)
+++ branches/upstream/libmoosex-types-perl/current/t/16_introspection.t Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/t/17_syntax_errors.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/t/17_syntax_errors.t?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/t/17_syntax_errors.t (original)
+++ branches/upstream/libmoosex-types-perl/current/t/17_syntax_errors.t Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/t/18_combined_libs.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/t/18_combined_libs.t?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/t/18_combined_libs.t (original)
+++ branches/upstream/libmoosex-types-perl/current/t/18_combined_libs.t Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/t/19_typelib_with_role.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/t/19_typelib_with_role.t?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/t/19_typelib_with_role.t (original)
+++ branches/upstream/libmoosex-types-perl/current/t/19_typelib_with_role.t Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/t/20_union_with_string_type.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/t/20_union_with_string_type.t?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/t/20_union_with_string_type.t (original)
+++ branches/upstream/libmoosex-types-perl/current/t/20_union_with_string_type.t Wed Dec 1 17:40:52 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: branches/upstream/libmoosex-types-perl/current/t/21_coerce_parameterized_types.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/t/21_coerce_parameterized_types.t?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/t/21_coerce_parameterized_types.t (original)
+++ branches/upstream/libmoosex-types-perl/current/t/21_coerce_parameterized_types.t Wed Dec 1 17:40:52 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();
Added: branches/upstream/libmoosex-types-perl/current/t/lib/Empty.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/t/lib/Empty.pm?rev=65452&op=file
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/t/lib/Empty.pm (added)
+++ branches/upstream/libmoosex-types-perl/current/t/lib/Empty.pm Wed Dec 1 17:40:52 2010
@@ -1,0 +1,3 @@
+package Empty;
+
+1;
Modified: branches/upstream/libmoosex-types-perl/current/t/regressions/01-is_subtype_of.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libmoosex-types-perl/current/t/regressions/01-is_subtype_of.t?rev=65452&op=diff
==============================================================================
--- branches/upstream/libmoosex-types-perl/current/t/regressions/01-is_subtype_of.t (original)
+++ branches/upstream/libmoosex-types-perl/current/t/regressions/01-is_subtype_of.t Wed Dec 1 17:40:52 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