From: Matthew Horsfall Date: Wed, 20 Jul 2011 00:48:00 +0000 (-0400) Subject: Add in Data::Perl::Collection::Set from DBIx-Data-Store-old so we can run tests. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FApp-IdiotBox.git;a=commitdiff_plain;h=6b6ce2e092408b58ffe70eafa49265b0c532be62;hp=ce2b1e73fc200bc54032b33af7487534d6608ca4 Add in Data::Perl::Collection::Set from DBIx-Data-Store-old so we can run tests. --- diff --git a/t/lib/Data/Perl/Collection/Set.pm b/t/lib/Data/Perl/Collection/Set.pm new file mode 100644 index 0000000..a35c62b --- /dev/null +++ b/t/lib/Data/Perl/Collection/Set.pm @@ -0,0 +1,21 @@ +package Data::Perl::Collection::Set; + +use Moose; +use Method::Signatures::Simple; +use Data::Perl::Stream::Array; + +has '_members' => (is => 'ro', required => 1, init_arg => 'members'); + +method map ($fun) { + (ref $self)->new( + members => [ map $fun->($_), @{$self->_members} ] + ) +} + +method to_stream { + Data::Perl::Stream::Array->new(array => [ @{$self->_members} ]) +} + +__PACKAGE__->meta->make_immutable; + +1; diff --git a/t/lib/Data/Perl/Stream/Array.pm b/t/lib/Data/Perl/Stream/Array.pm new file mode 100644 index 0000000..cb0ccf5 --- /dev/null +++ b/t/lib/Data/Perl/Stream/Array.pm @@ -0,0 +1,22 @@ +package Data::Perl::Stream::Array; + +use Moose; +use Method::Signatures::Simple; + +has _array => (is => 'rw', required => 1, init_arg => 'array'); + +method BUILD { $self->_array([ @{$self->_array} ]) } + +method next { + my $ary = $self->_array; + return unless @$ary; + return shift @$ary; +} + +method map ($map_func) { + ref($self)->new(array => [ map { $map_func->($_) } @{$self->_array} ]); +} + +__PACKAGE__->meta->make_immutable; + +1; diff --git a/t/show/bucket.t b/t/show/bucket.t index 5f1df83..b323619 100644 --- a/t/show/bucket.t +++ b/t/show/bucket.t @@ -1,4 +1,5 @@ use strict; +use lib qw(t/lib/); use warnings FATAL => 'all'; use Test::More; diff --git a/t/show/front_page.t b/t/show/front_page.t index 623b0bf..c5c9fa8 100644 --- a/t/show/front_page.t +++ b/t/show/front_page.t @@ -1,4 +1,5 @@ use strict; +use lib qw(t/lib); use warnings FATAL => 'all'; use Test::More; diff --git a/t/store/sqlite.t b/t/store/sqlite.t index a31f1c0..d0caa55 100644 --- a/t/store/sqlite.t +++ b/t/store/sqlite.t @@ -1,6 +1,8 @@ use strict; use warnings FATAL => 'all'; +use Test::More; + use App::IdiotBox::Store::SQLite; use App::IdiotBox; @@ -16,3 +18,7 @@ my $bucket = DwarnS $ib->{buckets}->get({ slug => 'opw2010'}); #Dwarn [ $bucket->{videos}->flatten ]; Dwarn $bucket->{videos}->get({ slug => 'troll-god-mountain' }); + +ok(1); # This even a test? -- alh + +done_testing;