use_ok stinks; just load the library
[gitmo/Moose-Autobox.git] / t / 001_basic.t
index 18fecd6..a0994d3 100644 (file)
@@ -3,11 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 63;
-
-BEGIN {
-    use_ok('Moose::Autobox');
-}
+use Test::More tests => 69;
 
 use Moose::Autobox;
 
@@ -24,6 +20,9 @@ ok($s->defined, '... got a defined value');
 eval $s->dump;
 is($VAR1, 5 , '... eval of SCALAR->dump works');
 
+eval $s->flatten;
+is($VAR1, 5 , '... eval of SCALAR->flatten works');
+
 eval $s->perl;
 is($s->perl, $s->dump, '... SCALAR->dump equals SCALAR->perl');
 
@@ -75,6 +74,10 @@ $a->map(sub { $_ + 2 }),
 
 is_deeply($a, [ 4, 2, 6, 78, 101, 2, 3 ], '... original value is unchanged');
 
+my $b = [1, 2, 3];
+$b->map(sub { $_++ } );
+is_deeply($b, [ 2, 3, 4 ], '... original value is changed');
+
 is_deeply(
 $a->reverse(),
 [ 3, 2, 101, 78, 6, 2, 4 ],
@@ -191,6 +194,10 @@ is( $a->dump,
     $a->perl,
     '... the value is correctly dumped with perl()' );
 
+is([1, 2, 3, 4, 5]->any, 3, '... any correctly found a value');
+is([1, 1, 2, 3, 4, 5, 5]->one, 2, '... one correctly found one value');
+is([1, 1, 2, 3, 4, 5, 5]->none , 6, '... none correctly did not find any of a value');
+is([3, 3, 3]->all, 3, '... all correctly found all of a value');
 
 # Hash
 
@@ -247,3 +254,7 @@ is( $h->dump,
 is_deeply( { one => 1, two => 2, three => 3 }->slice([qw/three one/]),
            [ qw/3 1/ ],
            '... hash slices ok' );
+
+is_deeply( { one => 1, two => 2, three => 3 }->hslice([qw/two three/]),
+           { two => 2, three => 3 },
+           '... hash hslices ok' );