This file is indexed.

/usr/share/perl5/CHI/Test/Util.pm is in libchi-perl 0.58-1.

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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package CHI::Test::Util;
{
  $CHI::Test::Util::VERSION = '0.58';
}
use Date::Parse;
use Test::Builder;
use Test::More;
use strict;
use warnings;
use base qw(Exporter);

our @EXPORT_OK =
  qw(activate_test_logger is_between cmp_bool random_string skip_until);

sub activate_test_logger {
    my $log = Log::Any->get_logger( category => 'CHI' );
    $log->clear();
    return $log;
}

sub is_between {
    my ( $value, $min, $max, $desc ) = @_;

    my $tb = Test::Builder->new();
    if ( $value >= $min && $value <= $max ) {
        $tb->ok( 1, $desc );
    }
    else {
        $tb->diag("$value is not between $min and $max");
        $tb->ok( undef, $desc );
    }
}

sub cmp_bool {
    my ( $bool1, $bool2, $desc ) = @_;

    my $tb = Test::Builder->new();
    if ( $bool1 && !$bool2 ) {
        $tb->ok( 0, "$desc - bool1 is true, bool2 is false" );
    }
    elsif ( !$bool1 && $bool2 ) {
        $tb->ok( 0, "$desc - bool1 is false, bool2 is true" );
    }
    else {
        $tb->ok( 1, $desc );
    }
}

sub skip_until {
    my ( $until_str, $how_many, $code ) = @_;

    my $until = str2time($until_str);
  SKIP: {
        skip "until $until_str", $how_many if ( time < $until );
        $code->();
    }
}

# Generate random string of printable ASCII characters.
#
sub random_string {
    my ($length) = @_;

    return join( '', map { chr( int( rand(95) + 33 ) ) } ( 1 .. $length ) );
}

1;