File: 15dump.t

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 (50 lines) | stat: -rw-r--r-- 1,391 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use Test::More;
use strict;
use warnings;
use File::Spec::Functions;
use SVN::Dump;

plan tests => 10;

# non-existing dumpfile
eval { my $dump = SVN::Dump->new( { file => 'krunch' } ); };
like( $@, qr/^Can't open krunch: /, "new() fails with non-existing file" );

# a SVN::Dump with a reader
my $dump
    = SVN::Dump->new( { file => catfile(qw( t dump full test123-r0.svn)) } );

is( $dump->version(), '', 'No dump format version yet' );
$dump->next_record();
is( $dump->version(), '2', 'Read dump format version' );

is( $dump->uuid(), '', 'No UUID yet' );
$dump->next_record();
is( $dump->uuid(), '2785358f-ed1c-0410-8d81-93a2a39f1216', 'Read UUID' );

my $as_string = join "\012", 'SVN-fs-dump-format-version: 2',
    "\012UUID: 2785358f-ed1c-0410-8d81-93a2a39f1216", "\012";

is( $dump->as_string(), $as_string, 'as_string()' );

# a SVN::Dump without a reader
$dump = SVN::Dump->new( { version => 3 } );
is( $dump->version(), '3', 'version set by new()' );

$dump = SVN::Dump->new( { uuid => 'bc4ef365-ce1c-0410-99c4-bdd0034106c0' } );
is( $dump->uuid(),
    'bc4ef365-ce1c-0410-99c4-bdd0034106c0',
    'uuid set by new()'
);

$dump = SVN::Dump->new(
    {   version => 2,
        uuid    => '77f6eb63-2709-0410-a607-da1692a51919'
    }
);
is( $dump->version(), '2', 'version set by new()' );
is( $dump->uuid(),
    '77f6eb63-2709-0410-a607-da1692a51919',
    'uuid set by new()'
);