summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2009-09-10 18:40:51 -0500
committerJesse Luehrs <doy@tozt.net>2009-09-10 18:40:51 -0500
commitcda7c4e67f52a39187e669978c2b7eddfca68811 (patch)
treed314e707521b4a0c261556c700867423a4db9bf6 /t
parent4b09119338204ab6f618b5be60cc7464d115fd39 (diff)
downloadmoosex-methodtraits-cda7c4e67f52a39187e669978c2b7eddfca68811.tar.gz
moosex-methodtraits-cda7c4e67f52a39187e669978c2b7eddfca68811.zip
add a simple test
Diffstat (limited to 't')
-rw-r--r--t/001-basic.t37
1 files changed, 37 insertions, 0 deletions
diff --git a/t/001-basic.t b/t/001-basic.t
new file mode 100644
index 0000000..a3b51eb
--- /dev/null
+++ b/t/001-basic.t
@@ -0,0 +1,37 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 3;
+use Test::Moose;
+
+BEGIN {
+ package Foo::Exporter;
+ use MooseX::MethodTraits;
+
+ MooseX::MethodTraits->setup_import_methods(
+ with_traits => {
+ command => {
+ traits => ['Foo::Command'],
+ }
+ }
+ );
+}
+
+{
+ package Foo::Command;
+ use Moose::Role;
+}
+
+{
+ package Foo;
+ use Moose;
+ BEGIN { Foo::Exporter->import }
+
+ command foo => sub { 'FOO' };
+}
+
+my $foo = Foo->new;
+can_ok($foo, 'foo');
+my $method = Foo->meta->get_method('foo');
+does_ok($method, 'Foo::Command');
+is($foo->foo, 'FOO', 'correct method is installed');