File: TestUtils.pm

package info (click to toggle)
libsvn-dump-perl 0.08-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 416 kB
  • sloc: perl: 682; makefile: 7
file content (35 lines) | stat: -rw-r--r-- 641 bytes parent folder | download | duplicates (6)
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
use strict;
use warnings;

eval { require Test::LongString; import Test::LongString; };
my $has_test_longstring = $@ eq '';

# our own string comparison test function
sub is_same_string {
    my ($got, $expected, $name) = @_;
    if ($has_test_longstring) {
        is_string( $got, $expected, $name);
    }
    else {
        is( $got, $expected, $name);
    }
}

sub file_content {
    my ($file) = @_;
    local $/;
    open my $fh, $file or do { diag "Can't open $file: $!"; return '' };
    my $content = join '', <$fh>;
    close $fh;
    return $content;
}

1;

__END__

=head1 NAME

t::Util - Some utility functions for the tests

=