File: 06-hash.t

package info (click to toggle)
libstring-trim-perl 0.005-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 204 kB
  • sloc: perl: 180; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 809 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use strict;
use warnings;
use Test::More 0.94 tests => 1;#2;
use String::Trim;

my $in = {
    "\none" => undef,
    'two'   => ' two',
    'three' => 'three ',
    ' four' => ' four ',
    'five'  => '  five  ',
};
my $out = {
    'one'   => undef,
    'two'   => 'two',
    'three' => 'three',
    'four'  => 'four',
    'five'  => 'five',
};

# subtest 'return' => sub {
    # plan tests => 1;
    # my %trimmed = trim(%$in);
    # is_deeply(\%trimmed, $out, 'trim(%hash) returns a trimmed hash OK');
# };

subtest 'in-place' => sub {
    TODO: {
        local $TODO = 'unimplemented';
        plan tests => 1;
        use Data::Dumper;
        # print STDERR Dumper $in;
        trim(%$in);
        # print STDERR Dumper $in;
        is_deeply($in, $out, 'trim(%hash) trims a hash in-place OK');
    }
};