Add in Data::Perl::Collection::Set from DBIx-Data-Store-old so we can run tests.
Matthew Horsfall [Wed, 20 Jul 2011 00:48:00 +0000 (20:48 -0400)]
t/lib/Data/Perl/Collection/Set.pm [new file with mode: 0644]
t/lib/Data/Perl/Stream/Array.pm [new file with mode: 0644]
t/show/bucket.t
t/show/front_page.t
t/store/sqlite.t

diff --git a/t/lib/Data/Perl/Collection/Set.pm b/t/lib/Data/Perl/Collection/Set.pm
new file mode 100644 (file)
index 0000000..a35c62b
--- /dev/null
@@ -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 (file)
index 0000000..cb0ccf5
--- /dev/null
@@ -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;
index 5f1df83..b323619 100644 (file)
@@ -1,4 +1,5 @@
 use strict;
+use lib qw(t/lib/);
 use warnings FATAL => 'all';
 use Test::More;
 
index 623b0bf..c5c9fa8 100644 (file)
@@ -1,4 +1,5 @@
 use strict;
+use lib qw(t/lib);
 use warnings FATAL => 'all';
 use Test::More;
 
index a31f1c0..d0caa55 100644 (file)
@@ -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;