#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
=pod
{ package Object::Test; }
-package Foo;
-::use_ok('Mouse');
+{
+ package Foo;
+ ::use_ok('Mouse');
+}
+
+done_testing;
#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use strict;
use warnings;
use lib 't/lib', 'lib';
-use Test::More tests => 2;
-
-
+use Test::More;
use_ok('MyMouseA');
-use_ok('MyMouseB');
\ No newline at end of file
+use_ok('MyMouseB');
+
+done_testing;
--- /dev/null
+#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
+
+use strict;
+use warnings;
+
+use lib 't/lib', 'lib';
+
+use Test::More;
+
+use_ok('MyMouseObject');
+
+done_testing;
#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use strict;
use warnings;
-use Test::More tests => 2;
-
-
+use Test::More;
=pod
my $bar = Bar->new;
isa_ok($bar, 'Bar');
isa_ok($bar, 'Foo');
+
+done_testing;
#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
use Test::Exception;
-
=pod
This was a bug, but it is fixed now. This
} '... this didnt die';
}
+done_testing;
#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
{
package Foo;
is($foo->$reader, 10, "Reader works as expected");
}
-
-
-
+done_testing;
#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use strict;
use warnings;
-use Test::More tests => 3;
-
+use Test::More;
{
'Foo::foo(Baz::foo and Foo::foo())',
'... got the right value for 1 augmented subclass calling non-augmented subclass');
+done_testing;
#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use strict;
use warnings;
-use Test::More tests => 2;
-
+use Test::More;
{
$foo->bar();
is($Foo::bar_default_called, 1, "bar default was only called once when lazy attribute is accessed");
+
+done_testing;
#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use strict;
use warnings;
use FindBin;
-use Test::More tests => 144;
+use Test::More;
use Test::Exception;
use Mouse::Util::TypeConstraints;
}
}
-1;
-
+done_testing;
#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use strict;
use warnings;
if Baz->meta->is_mutable
}
-# The following tests will fail on 5.13.0, so skipt them :(
-if($] >= 5.013) {
- done_testing;
- exit;
-}
-
-{
- package Quux;
- use Mouse;
-
- sub DEMOLISH {
- die "foo\n";
- }
-}
-
-{
- local $@ = 42;
-
- eval { my $obj = Quux->new };
-
- like( $@, qr/foo/, '$@ contains error from demolish when demolish dies' );
-
- Quux->meta->make_immutable, redo
- if Quux->meta->is_mutable
-}
-
done_testing;
-use strict;
-use Test::More tests => 4;
-
package Foo;
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use Mouse;
## Problem:
#### or, make required accept undef and use a predicate test
-has 'foo' => ( isa => 'Int | Undef', is => 'rw', coerce => 1, lazy_build => 1 );
-has 'bar' => ( isa => 'Int | Undef', is => 'rw', coerce => 1 );
+has 'foo' => ( isa => 'Int | Undef', is => 'rw', lazy_build => 1 );
+has 'bar' => ( isa => 'Int | Undef', is => 'rw' );
sub _build_foo { undef }
package main;
+use Test::More;
ok ( !defined(Foo->new->bar), 'NonLazyBuild: Undef default' );
ok ( !defined(Foo->new->bar(undef)), 'NonLazyBuild: Undef explicit' );
## This test fails at the time of creation.
ok ( !defined(Foo->new->foo(undef)), 'LazyBuild: Undef explicit' );
+
+done_testing;
#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
use Test::Exception;
-
{
package My::Role;
use Mouse::Role;
} qr/You cannot inherit from a Mouse Role \(My\:\:Role\)/,
'... this croaks correctly';
}
+
+done_testing;
#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
use Test::Exception;
-
# RT #37569
{
qr/Attribute \(nt\) does not pass the type constraint because: blessed/,
'... got the right error message';
+done_testing;
#!/usr/bin/env perl
-use Test::More tests => 10;
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
+use Test::More;
{
my $package = qq{
my $obj = Test::Mouse::Go::Boom5->new;
::is( $obj->id, '0 but true', 'value is still the same' );
}
+
+done_testing;
use strict;
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use warnings;
-use Test::More tests => 3;
+use Test::More;
{
package A;
is( C->new->foo, 'c' );
is( C->new->bar, 'cb' );
is( C->new->baz, 'cba' );
+
+done_testing;
-use Test::More tests => 4;
-
package MyRole;
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use Mouse::Role;
package main;
+use Test::More;
+
{
local $TODO = 'Role composition does not clone methods yet';
is(MyClass1->foo, 'MyClass1::foo',
isnt(MyClass1->foo, "MyClass2::foo", "role method is not confused with other class" );
isnt(MyClass2->foo, "MyClass1::foo", "role method is not confused with other class" );
+
+done_testing;
use strict;
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use warnings;
use Test::Exception;
-use Test::More tests => 2;
+use Test::More;
{
my $foo = Foo->new;
::isa_ok $foo, 'Bar';
}
+
+done_testing;
use strict;
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use warnings;
-use Test::More tests => 1;
+use Test::More;
use Test::Exception;
use Mouse::Meta::Class;
TODO:
{
-# local $TODO
-# = 'Loading Mouse::Meta::Class without loading Mouse.pm causes weird problems';
+ local $TODO
+ = 'Loading Mouse::Meta::Class without loading Mouse.pm causes weird problems';
my $meta;
lives_ok {
}
'Class is created successfully';
}
+
+done_testing;
#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
{
package Foo;
ok(Foo->new()->bug(), 'call constructor on object reference with overloading');
+done_testing;
--- /dev/null
+#!/usr/bin/perl
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
+use strict;
+use warnings;
+use Test::More;
+use Test::Exception;
+
+{
+ package Point;
+ use Mouse;
+
+ with qw/DoesNegated DoesTranspose/;
+
+ has x => ( isa => 'Int', is => 'rw' );
+ has y => ( isa => 'Int', is => 'rw' );
+
+ sub inspect { [$_[0]->x, $_[0]->y] }
+
+ no Mouse;
+}
+
+{
+ package DoesNegated;
+ use Mouse::Role;
+
+ sub negated {
+ my $self = shift;
+ $self->new( x => -$self->x, y => -$self->y );
+ }
+
+ no Mouse::Role;
+}
+
+{
+ package DoesTranspose;
+ use Mouse::Role;
+
+ sub transpose {
+ my $self = shift;
+ $self->new( x => $self->y, y => $self->x );
+ }
+
+ no Mouse::Role;
+}
+
+my $p = Point->new( x => 4, y => 3 );
+
+DoesTranspose->meta->apply( $p, -alias => { transpose => 'negated' } );
+
+is_deeply($p->negated->inspect, [3, 4]);
+is_deeply($p->transpose->inspect, [3, 4]);
+
+done_testing;
--- /dev/null
+use strict;
+# This is automatically generated by author/import-moose-test.pl.
+# DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!!
+use t::lib::MooseCompat;
+use warnings;
+
+use Test::More;
+use Test::Exception;
+use Test::Mouse;
+
+{
+ package Foo;
+
+ use Mouse::Deprecated -api_version => '1.07';
+ use Mouse;
+
+ has x => (
+ is => 'rw',
+ isa => 'HashRef',
+ coerce => 1,
+ );
+}
+
+with_immutable {
+ lives_ok { Foo->new( x => {} ) }
+ 'Setting coerce => 1 without a coercion on the type does not cause an error in the constructor';
+
+ lives_ok { Foo->new->x( {} ) }
+ 'Setting coerce => 1 without a coercion on the type does not cause an error when setting the attribut';
+
+ throws_ok { Foo->new( x => 42 ) }
+ qr/\QAttribute (x) does not pass the type constraint because/,
+ 'Attempting to provide an invalid value to the constructor for this attr still fails';
+
+ throws_ok { Foo->new->x(42) }
+ qr/\QAttribute (x) does not pass the type constraint because/,
+ 'Attempting to provide an invalid value to the accessor for this attr still fails';
+}
+'Foo';
+
+done_testing;