Skip to content

Commit

Permalink
Add basic tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
rafl committed Jul 12, 2009
1 parent ebc88d2 commit 4ff81e6
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
19 changes: 19 additions & 0 deletions t/basic.t
@@ -0,0 +1,19 @@
use strict;
use warnings;
use Test::More;

use FindBin;
use lib "$FindBin::Bin/lib";

BEGIN { use_ok('Class') }

ok(Class->meta->does_role('Role'));

my $foo = Class->new({ message => 'foo' });
isa_ok($foo, 'Class');
is($foo->message, 'foo');

my $str = "${foo}";
is($str, 'foo');

done_testing;
8 changes: 8 additions & 0 deletions t/lib/Class.pm
@@ -0,0 +1,8 @@
package Class;

use Moose;
use namespace::clean -except => 'meta';

with 'Role';

1;
16 changes: 16 additions & 0 deletions t/lib/Role.pm
@@ -0,0 +1,16 @@
package Role;

use MooseX::Role::WithOverloading;
use namespace::clean -except => 'meta';

use overload
q{""} => 'message',
fallback => 1;

has message => (
is => 'ro',
isa => 'Str',
required => 1,
);

1;

0 comments on commit 4ff81e6

Please sign in to comment.