/usr/share/perl5/CHI/t/Util.pm is in libchi-perl 0.60-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | package CHI::t::Util;
$CHI::t::Util::VERSION = '0.60';
use strict;
use warnings;
use CHI::Test;
use CHI::Util qw(unique_id parse_memory_size);
use CHI::Test::Util qw(random_string);
use List::MoreUtils qw(uniq);
use base qw(CHI::Test::Class);
# The inevitably lame unique_id test
sub test_unique_id : Tests {
my @ids = map { unique_id } ( 0 .. 9 );
cmp_deeply( \@ids, [ uniq(@ids) ], 'generated ten unique ids' );
}
sub test_random_string : Tests {
my @strings = map { random_string(100) } ( 0 .. 2 );
cmp_deeply(
\@strings,
[ uniq(@strings) ],
'generated three unique strings'
);
cmp_deeply(
[ map { length($_) } @strings ],
[ 100, 100, 100 ],
'lengths are 100'
);
}
sub test_non_common_constructor_params : Tests {
my $params =
{ map { ( $_, 1 ) } qw( foo expires_in bar baz on_get_error ) };
my $non_common_params = CHI::Driver->non_common_constructor_params($params);
cmp_deeply( $non_common_params, { map { ( $_, 1 ) } qw(foo bar baz) } );
}
sub test_parse_memory_size : Tests {
my %results = (
'12345' => '12345',
'50K' => 50 * 1024,
'8Mb' => 8 * 1024 * 1024,
'301k' => 301 * 1024,
);
while ( my ( $input, $expected ) = each(%results) ) {
is( parse_memory_size($input), $expected );
}
throws_ok { parse_memory_size('8kk') } qr/cannot parse/;
}
1;
|