]> git.vpit.fr Git - perl/modules/Sub-Prototype-Util.git/blobdiff - t/10-flatten.t
_ shouldn't push elements in flatten, but skip them
[perl/modules/Sub-Prototype-Util.git] / t / 10-flatten.t
index 05f56e7fa35f5fb97c1098a0018c03cf4ebf4838..414cfcf26305652eee0a07960b31dde6a6fd618d 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 26;
+use Test::More tests => 27;
 
 use Sub::Prototype::Util qw/flatten/;
 
@@ -40,10 +40,9 @@ my @tests = (
  [ '\&$',      'coderef', [ \&main::hlagh,  1 ], [ 'HLAGH',   1 ] ],
  [ '\[$@%]',   'class got scalarref',    [ \1 ], [ 1 ] ],
  [ '\[$@%]',   'class got arrayref',  [ [ 1 ] ], [ 1 ] ],
- [ '\[$@%]',   'class got hashref', [ { 1,2 } ], [ 1, 2 ] ]
+ [ '\[$@%]',   'class got hashref', [ { 1,2 } ], [ 1, 2 ] ],
+ [ '_',        '_ with argument',      [ 1, 2 ], [ ] ],
+ [ '_',        '_ with no argument',        [ ], [ ] ]
 );
-my $l = [ '_', '$_', [ ] ];
-$l->[3] = [ $l ];
-push @tests, $l;
 
 is_deeply( [ flatten($_->[0], @{$_->[2]}) ], $_->[3], $_->[1]) for @tests;