From dfd8a857fa2b0b5194962ad9e18be144a41631ca Mon Sep 17 00:00:00 2001 From: Kent Fredric Date: Sun, 7 Nov 2010 06:56:14 +1300 Subject: [PATCH 1/5] +ProvideRecord tests --- t/02-MetaProvides-ProvideRecord.t | 69 +++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 t/02-MetaProvides-ProvideRecord.t diff --git a/t/02-MetaProvides-ProvideRecord.t b/t/02-MetaProvides-ProvideRecord.t new file mode 100644 index 0000000..3d2a71b --- /dev/null +++ b/t/02-MetaProvides-ProvideRecord.t @@ -0,0 +1,69 @@ +use strict; +use warnings; + +use Test::More; +use lib 't/lib'; + +use Dist::Zilla::Util::Test::KENTNL qw( test_config ); +use Dist::Zilla::MetaProvides::ProvideRecord; +use Test::Fatal; +use Scalar::Util qw( refaddr ); + +my $fake_dzil = test_config( + { + dist_root => 'corpus/dist/DZT', + ini => [ 'GatherDir', [ 'Prereqs' => { 'Test::Simple' => '0.88' } ], [ 'FakePlugin' => {} ] ], + } +); + +my $record; + +is( + exception { + $record = Dist::Zilla::MetaProvides::ProvideRecord->new( + version => '1.0', + module => 'FakeModule', + file => 'fakefile', + parent => $fake_dzil->plugin_named('FakePlugin'), + ); + }, + undef, + 'Construction works' +); + +can_ok( $record, 'version' ); +is( $record->version, '1.0', 'version is consistent' ); + +can_ok( $record, 'module' ); +is( $record->module, 'FakeModule', 'module is consistent' ); + +can_ok( $record, 'file' ); +is( $record->file, 'fakefile', 'file is consistent' ); + +can_ok( $record, 'parent' ); +is( refaddr $record->parent, refaddr $fake_dzil->plugin_named('FakePlugin'), 'parent link is right' ); + +can_ok( $record, 'zilla' ); +is( refaddr $record->zilla, refaddr $fake_dzil , 'dzil link is right' ); + +can_ok( $record, '_resolve_version' ); + +is_deeply( [ $record->_resolve_version(3.1415) ], [ 'version', '0.001' ], '_resolve_version internal works as expected' ); + +can_ok( $record, 'copy_into' ); + +my $hash = {}; +$record->copy_into($hash); + +is_deeply( + $hash, + { + FakeModule => { + file => 'fakefile', + version => '0.001', + } + }, + 'copy_into structures match' +); + +done_testing; From 08c6fa092560dc8fe8831ef6c1c3b38e5b264eb4 Mon Sep 17 00:00:00 2001 From: Kent Fredric Date: Sun, 7 Nov 2010 07:13:09 +1300 Subject: [PATCH 2/5] +Basic type tests --- t/03-Types.t | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 t/03-Types.t diff --git a/t/03-Types.t b/t/03-Types.t new file mode 100644 index 0000000..56dfe35 --- /dev/null +++ b/t/03-Types.t @@ -0,0 +1,30 @@ +use strict; +use warnings; + +use Test::More; + +use Dist::Zilla::MetaProvides::Types qw( :all ); + +{ + + package Dist::Zilla::Role::MetaProvider::Provider; + use Moose::Role; +} +{ + + package Test; + use Moose; + with 'Dist::Zilla::Role::MetaProvider::Provider'; + __PACKAGE__->meta->make_immutable; +} + +isa_ok( \&ModVersion, 'CODE' ); +isa_ok( \&ProviderObject, 'CODE' ); +isa_ok( \&is_ModVersion, 'CODE' ); +isa_ok( \&is_ProviderObect, 'CODE' ); +ok( is_ModVersion('1.0'), '1.0 is a valid module version' ); +ok( is_ModVersion(undef), 'undef is a valid module version' ); +ok( is_ModVersion('9999'), '9999 is a valid module version' ); +ok( is_ProviderObject( Test->new() ), 'Given obeject is a ProviderObject' ); + +done_testing; From a4e856824fb1423b41b60294b660789b3134cc67 Mon Sep 17 00:00:00 2001 From: Kent Fredric Date: Sun, 7 Nov 2010 07:14:09 +1300 Subject: [PATCH 3/5] update changelog --- Changes | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Changes b/Changes index 09f513e..a2a0d32 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,9 @@ Revision history for {{$dist->name}} {{$NEXT}} + A little bit more testing of the codebase, + tests should be now comprehensive enough to + detect most change-bugs. 1.12044803 2010-11-07 04:26:58 Pacific/Auckland Build ourself using MetaNoIndex to hide corpus/ crap. From d72a1a65d05f4ab54b693f80aad1a96f13543d83 Mon Sep 17 00:00:00 2001 From: Kent Fredric Date: Sun, 7 Nov 2010 07:15:41 +1300 Subject: [PATCH 4/5] -changelog ws --- Changes | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Changes b/Changes index a2a0d32..cd0fb92 100644 --- a/Changes +++ b/Changes @@ -2,7 +2,7 @@ Revision history for {{$dist->name}} {{$NEXT}} A little bit more testing of the codebase, - tests should be now comprehensive enough to + tests should be now comprehensive enough to detect most change-bugs. 1.12044803 2010-11-07 04:26:58 Pacific/Auckland @@ -58,9 +58,9 @@ Revision history for {{$dist->name}} 1.10001919 2009-09-12 06:17:57 UTC Dropped the version dep on FindBin because it causes - problems for some. Apparently deping on something that + problems for some. Apparently deping on something that may or may not be in core which may or may not be in core - later is a bad thing. + later is a bad thing. Added CompileTests Add dist.ini to release for diagnostic reasons. From c7e66bccab9c8e1bd95f9a493cfeeb8a6efbc4b5 Mon Sep 17 00:00:00 2001 From: Kent Fredric Date: Sun, 7 Nov 2010 07:21:17 +1300 Subject: [PATCH 5/5] v1.12044806 A little bit more testing of the codebase, tests should be now comprehensive enough to detect most change-bugs. --- Changes | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changes b/Changes index cd0fb92..20f7a8e 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ Revision history for {{$dist->name}} {{$NEXT}} + +1.12044806 2010-11-07 07:20:55 Pacific/Auckland A little bit more testing of the codebase, tests should be now comprehensive enough to detect most change-bugs.