diff options
author | Jesse Luehrs <doy@tozt.net> | 2009-05-28 20:08:11 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2009-05-28 20:08:11 -0500 |
commit | 4b096c4a2cdedca8542f7316f2dba6ad1acf50c8 (patch) | |
tree | 0c541e1aa7b056d9b54e49198b3aaafdd854c67b /t | |
parent | b6754f9c83d813eb0429fafd45bd5dd75f341f61 (diff) | |
download | moosex-abc-4b096c4a2cdedca8542f7316f2dba6ad1acf50c8.tar.gz moosex-abc-4b096c4a2cdedca8542f7316f2dba6ad1acf50c8.zip |
basic tests (failing)
Diffstat (limited to 't')
-rw-r--r-- | t/000-load.t | 8 | ||||
-rw-r--r-- | t/001-basic.t | 33 |
2 files changed, 41 insertions, 0 deletions
diff --git a/t/000-load.t b/t/000-load.t new file mode 100644 index 0000000..3a051f6 --- /dev/null +++ b/t/000-load.t @@ -0,0 +1,8 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More tests => 1; + +package Foo; +::use_ok('MooseX::ABC') + or ::BAIL_OUT("couldn't load MooseX::ABC"); diff --git a/t/001-basic.t b/t/001-basic.t new file mode 100644 index 0000000..bae0cc0 --- /dev/null +++ b/t/001-basic.t @@ -0,0 +1,33 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More tests => 5; +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 main; +my $foosub; +lives_ok { $foosub = Foo::Sub1->new } + 'instantiating concrete subclasses works'; +isa_ok($foosub, 'Foo', 'inheritance is correct'); +TODO: { + local $TODO = "constructor stuff isn't done yet"; + dies_ok { Foo->new } 'instantiating abstract classes fails'; +} |