summaryrefslogtreecommitdiffstats
path: root/t/01-basic.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-07-18 23:58:56 -0500
committerJesse Luehrs <doy@tozt.net>2010-07-19 00:03:12 -0500
commitcb170931288a0dbef03fece2a0fa01decbd5dfbb (patch)
treeabf1e0c128bdb1932b6cd7d33a44a7d45511d951 /t/01-basic.t
parent2f257268ef4fe266b0b24bf182242961cfd85ce2 (diff)
downloadmoosex-abc-cb170931288a0dbef03fece2a0fa01decbd5dfbb.tar.gz
moosex-abc-cb170931288a0dbef03fece2a0fa01decbd5dfbb.zip
update dzil stuff0.05
Diffstat (limited to 't/01-basic.t')
-rw-r--r--t/01-basic.t40
1 files changed, 40 insertions, 0 deletions
diff --git a/t/01-basic.t b/t/01-basic.t
new file mode 100644
index 0000000..d5951d4
--- /dev/null
+++ b/t/01-basic.t
@@ -0,0 +1,40 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 9;
+use Test::Exception;
+
+package Foo;
+use Moose;
+use MooseX::ABC;
+
+requires 'bar', 'baz';
+
+package Foo::Sub1;
+use Moose;
+::lives_ok { extends 'Foo' } 'extending works when the requires are fulfilled';
+sub bar { }
+sub baz { }
+
+package Foo::Sub2;
+use Moose;
+::throws_ok { extends 'Foo' } qr/Foo requires Foo::Sub2 to implement baz/,
+ 'extending fails with the correct error when requires are not fulfilled';
+sub bar { }
+
+package Foo::Sub::Sub;
+use Moose;
+::lives_ok { extends 'Foo::Sub1' } 'extending twice works';
+
+package main;
+my $foosub;
+lives_ok { $foosub = Foo::Sub1->new }
+ 'instantiating concrete subclasses works';
+isa_ok($foosub, 'Foo', 'inheritance is correct');
+my $foosubsub;
+lives_ok { $foosubsub = Foo::Sub::Sub->new }
+ 'instantiating deeper concrete subclasses works';
+isa_ok($foosubsub, 'Foo', 'inheritance is correct');
+isa_ok($foosubsub, 'Foo::Sub1', 'inheritance is correct');
+throws_ok { Foo->new } qr/Foo is abstract, it cannot be instantiated/,
+ 'instantiating abstract classes fails';