+++ /dev/null
-#!/usr/bin/env perl
-use strict;
-use warnings;
-use Test::More;
-
-BEGIN {
- eval "use Test::Output;";
- plan skip_all => "Test::Output is required for this test" if $@;
- plan tests => 2;
-}
-
-stderr_is(
- sub { package main; eval 'use Mouse' },
- "Mouse does not export its sugar to the 'main' package.\n",
- 'Mouse warns when loaded from the main package',
-);
-
-stderr_is(
- sub { package main; eval 'use Mouse::Role' },
- "Mouse::Role does not export its sugar to the 'main' package.\n",
- 'Mouse::Role warns when loaded from the main package',
-);
-
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 7;
+use Test::More tests => 11;
use Test::Exception;
use Mouse::Util::TypeConstraints;
=> where { length $_ }
=> message { "The string is empty!" };
+ subtype 'MyClass'
+ => as 'Object'
+ => where { $_->isa(__PACKAGE__) };
+
has name => (
is => 'ro',
isa => 'NonemptyStr',
);
+
+
};
ok(My::Class->new(name => 'foo'));
ok!$st->check(undef);
ok!$st->check('');
+lives_and{
+ my $tc = find_type_constraint('MyClass');
+ ok $tc->check(My::Class->new());
+ ok!$tc->check('My::Class');
+ ok!$tc->check([]);
+ ok!$tc->check(undef);
+};
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Test::More;
-BEGIN {
- eval "use Test::Output;";
- plan skip_all => "Test::Output is required for this test" if $@;
- plan tests => 2;
-}
-
-stderr_like( sub { package main; eval 'use Mouse' },
- qr/\QMouse does not export its sugar to the 'main' package/,
- 'Mouse warns when loaded from the main package' );
-
-stderr_like( sub { package main; eval 'use Mouse::Role' },
- qr/\QMouse::Role does not export its sugar to the 'main' package/,
- 'Mouse::Role warns when loaded from the main package' );
use strict;
use warnings;
-use Test::More tests => 26;
+use Test::More tests => 8; # tests => 26;
use Test::Exception;
use lib 't/lib';
use Mouse;
use Mouse::Util::TypeConstraints;
- subtype 'HeadersType' => as 'Object' => where { defined $_ && eval { $_->isa('Headers') } };
+ subtype 'HeadersType' => as 'Object' => where { $_->isa('Headers') };
coerce 'HeadersType' =>
from 'ScalarRef' => via {
Headers->new();
use Mouse;
use Mouse::Util::TypeConstraints;
- type 'Headers' => where { defined $_ && eval { $_->isa('Response::Headers') } };
+ subtype 'Headers' => as 'Object', where { $_->isa('Response::Headers') };
coerce 'Headers' =>
from 'HashRef' => via {
Response::Headers->new(%{ $_ });