File: sliced.t

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

use Lowu;

my $hr = +{a => 1, b => 2, c => 3, d => 4};
my $slice = $hr->sliced('a', 'c', 'z');
ok $slice->keys->count == 2, 'boxed sliced key count ok';

ok $slice->get('a') == 1, 'sliced get ok';

ok !$slice->exists('z'), 'nonexistant key ignored';
ok !$slice->get('b'), 'unspecified key ignored';

done_testing;