Permalink
Browse files

cleanups

  • Loading branch information...
1 parent 9a6b074 commit c700061c7b00d18778389d0850d21f966bd25ec6 @doy committed Apr 25, 2012
Showing with 216 additions and 188 deletions.
  1. +5 −1 .gitignore
  2. +4 −5 dist.ini
  3. +2 −1 lib/MooseX/ABC.pm
  4. +0 −40 t/01-basic.t
  5. +0 −46 t/02-immutable.t
  6. +0 −24 t/03-custom-constructor.t
  7. +0 −35 t/04-abstract-subclass.t
  8. +50 −0 t/abstract-subclass.t
  9. +60 −0 t/basic.t
  10. +29 −0 t/custom-constructor.t
  11. +66 −0 t/immutable.t
  12. +0 −36 weaver.ini
View
@@ -1,5 +1,6 @@
cover_db
-META.yml
+META.*
+MYMETA.*
Makefile
blib
inc
@@ -9,5 +10,8 @@ Makefile.old
nytprof.out
MANIFEST.bak
*.sw[po]
+.DS_Store
.build
MooseX-ABC-*
+*.bs
+*.o
View
@@ -4,10 +4,9 @@ license = Perl_5
copyright_holder = Jesse Luehrs
[@DOY]
+:version = 0.08
dist = MooseX-ABC
+repository = github
-[Prereq]
-Moose = 0.94
-
-[Prereq / TestRequires]
-Test::Exception = 0
+[AutoPrereqs]
+skip = Foo
View
@@ -1,5 +1,5 @@
package MooseX::ABC;
-use Moose ();
+use Moose 0.94 ();
use Moose::Exporter;
# ABSTRACT: abstract base classes for Moose
@@ -74,6 +74,7 @@ sub init_meta {
=head1 SEE ALSO
L<Moose>
+
L<Moose::Role>
=begin Pod::Coverage
View
@@ -1,40 +0,0 @@
-#!/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';
View
@@ -1,46 +0,0 @@
-#!/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__->meta->make_immutable;
-
-package Foo::Sub1;
-use Moose;
-::lives_ok { extends 'Foo' } 'extending works when the requires are fulfilled';
-sub bar { }
-sub baz { }
-
-__PACKAGE__->meta->make_immutable;
-
-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__->meta->make_immutable;
-
-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';
View
@@ -1,24 +0,0 @@
-#!/usr/bin/env perl
-use strict;
-use warnings;
-use Test::More tests => 1;
-
-our $custom_constructor_called = 0;
-
-package Foo;
-use Moose;
-use MooseX::ABC;
-
-requires 'bar', 'baz';
-
-package Foo::Sub;
-use Moose;
-extends 'Foo';
-
-sub bar { }
-sub baz { }
-sub new { $::custom_constructor_called++; shift->SUPER::new(@_) }
-
-package main;
-my $foosub = Foo::Sub->new;
-ok($custom_constructor_called, 'custom constructor was called');
View
@@ -1,35 +0,0 @@
-#!/usr/bin/env perl
-use strict;
-use warnings;
-use Test::More tests => 3;
-use Test::Exception;
-
-package Foo;
-use Moose;
-use MooseX::ABC;
-
-requires 'foo';
-requires 'bar';
-
-package Foo::Sub;
-use Moose;
-use MooseX::ABC;
-extends 'Foo';
-
-requires 'baz';
-
-sub bar { 'BAR' }
-
-package Foo::Sub::Sub;
-use Moose;
-extends 'Foo::Sub';
-
-sub foo { 'FOO' }
-sub baz { 'BAZ' }
-
-package main;
-
-dies_ok { Foo->new } "can't create Foo objects";
-dies_ok { Foo::Sub->new } "can't create Foo::Sub objects";
-my $foo = Foo::Sub::Sub->new;
-is($foo->foo, 'FOO', 'successfully created a Foo::Sub::Sub object');
View
@@ -0,0 +1,50 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use Test::Fatal;
+
+{
+ package Foo;
+ use Moose;
+ use MooseX::ABC;
+
+ requires 'foo';
+ requires 'bar';
+}
+
+{
+ package Foo::Sub;
+ use Moose;
+ use MooseX::ABC;
+ extends 'Foo';
+
+ requires 'baz';
+
+ sub bar { 'BAR' }
+}
+
+{
+ package Foo::Sub::Sub;
+ use Moose;
+ extends 'Foo::Sub';
+
+ sub foo { 'FOO' }
+ sub baz { 'BAZ' }
+}
+
+like(
+ exception { Foo->new },
+ qr/Foo is abstract, it cannot be instantiated/,
+ "can't create Foo objects"
+);
+like(
+ exception { Foo::Sub->new },
+ qr/Foo::Sub is abstract, it cannot be instantiated/,
+ "can't create Foo::Sub objects"
+);
+
+my $foo = Foo::Sub::Sub->new;
+is($foo->foo, 'FOO', 'successfully created a Foo::Sub::Sub object');
+
+done_testing;
View
@@ -0,0 +1,60 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use Test::Fatal;
+
+{
+ package Foo;
+ use Moose;
+ use MooseX::ABC;
+
+ requires 'bar', 'baz';
+}
+
+{
+ package Foo::Sub1;
+ use Moose;
+ ::is(::exception { extends 'Foo' }, undef,
+ "extending works when the requires are fulfilled");
+ sub bar { }
+ sub baz { }
+}
+
+{
+ package Foo::Sub2;
+ use Moose;
+ ::like(
+ ::exception { 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;
+ ::is(::exception { extends 'Foo::Sub1' }, undef,
+ "extending twice works");
+}
+
+{
+ my $foosub;
+ is(exception { $foosub = Foo::Sub1->new }, undef,
+ "instantiating concrete subclasses works");
+ isa_ok($foosub, 'Foo', 'inheritance is correct');
+}
+
+{
+ my $foosubsub;
+ is(exception { $foosubsub = Foo::Sub::Sub->new }, undef,
+ "instantiating deeper concrete subclasses works");
+ isa_ok($foosubsub, 'Foo', 'inheritance is correct');
+ isa_ok($foosubsub, 'Foo::Sub1', 'inheritance is correct');
+}
+
+like(exception { Foo->new }, qr/Foo is abstract, it cannot be instantiated/,
+ "instantiating abstract classes fails");
+
+done_testing;
View
@@ -0,0 +1,29 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+our $custom_constructor_called = 0;
+
+{
+ package Foo;
+ use Moose;
+ use MooseX::ABC;
+
+ requires 'bar', 'baz';
+}
+
+{
+ package Foo::Sub;
+ use Moose;
+ extends 'Foo';
+
+ sub bar { }
+ sub baz { }
+ sub new { $::custom_constructor_called++; shift->SUPER::new(@_) }
+}
+
+my $foosub = Foo::Sub->new;
+ok($custom_constructor_called, 'custom constructor was called');
+
+done_testing;
Oops, something went wrong.

0 comments on commit c700061

Please sign in to comment.