File: part_to_hash.t

package info (click to toggle)
liblist-objects-withutils-perl 2.028003-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,276 kB
  • sloc: perl: 1,957; makefile: 17; sh: 6
file content (22 lines) | stat: -rw-r--r-- 513 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use Test::More;
use strict; use warnings FATAL => 'all';

use Lowu;

my $hs = 
  [qw/ann andy bob fred frankie/]
    ->part_to_hash(sub { ucfirst substr $_, 0, 1 });

isa_ok $hs, 'List::Objects::WithUtils::Hash';

ok $hs->keys->count == 3, 'boxed part_to_hash created 3 keys';

for (qw/A B F/) {
  isa_ok $hs->get($_), 'List::Objects::WithUtils::Array', "part '$_'";
}

is_deeply +{ $hs->export },
  +{ A => [qw/ann andy/], B => ['bob'], F => [qw/fred frankie/] },
  'boxed part_to_hash looks ok';

done_testing;