]> git.vpit.fr Git - perl/modules/Sub-Nary.git/blobdiff - t/20-return.t
Add support and tests for the get{pw,gr,host,net,proto,serv}* functions. Move ops...
[perl/modules/Sub-Nary.git] / t / 20-return.t
index 3d16d45ec24c8eff0190203e4fc39fe7607c0abc..e7e852d0c8e84582933beae4bc81c527c5018792 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 48;
+use Test::More tests => 50;
 
 use Sub::Nary;
 
@@ -39,6 +39,8 @@ my @tests = (
  [ sub { return @h{qw/a b/} },     2 ],
  [ sub { return @h{@a[1 .. 3]} },  3 ],
  [ sub { return @h{@a[$y .. 3]} }, 'list' ],
+ [ sub { return keys %h },         'list' ],
+ [ sub { return values %h },       'list' ],
 
  [ sub { return $x, $a[3], $h{c} }, 3 ],
  [ sub { return $x, @a },           'list' ],
@@ -75,6 +77,7 @@ my @tests = (
 my $i = 1;
 for (@tests) {
  my $r = $sn->nary($_->[0]);
- is_deeply($r, { $_->[1] => 1 }, 'return test ' . $i);
+ my $exp = ref $_->[1] ? $_->[1] : { $_->[1] => 1 };
+ is_deeply($r, $exp, 'return test ' . $i);
  ++$i;
 }