Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/bindings/swig/perl/native/t/2fs.t view on Meta::CPAN
$txn->root->make_dir('trunk');
my $path = 'trunk/filea';
my $text = "this is just a test\n";
$txn->root->make_file($path);
{
my $stream = $txn->root->apply_text($path, undef);
# TEST
isa_ok($stream, 'SVN::Stream', '$txn->root->apply_text');
print $stream $text;
close $stream;
}
$txn->commit;
# TEST
cmp_ok($fs->youngest_rev, '==', 1, 'revision increased');
my $root = $fs->revision_root($fs->youngest_rev);
# TEST
cmp_ok($root->check_path($path), '==', $SVN::Node::file, 'check_path');
# TEST
ok(!$root->is_dir($path), 'is_dir');
# TEST
ok($root->is_file($path), 'is_file');
{
my $stream = $root->file_contents($path);
local $/;
# TEST
is(<$stream>, $text, 'content verified');
# TEST
is($root->file_md5_checksum($path), 'dd2314129f81675e95b940ff94ddc935',
'md5 verified');
}
# TEST
cmp_ok($root->file_length($path), '==', length($text), 'file_length');
# Revision properties
# TEST
isa_ok($fs->revision_proplist(1), 'HASH', 'revision_proplist: object');
# TEST
is($fs->revision_prop(1, 'not:exists'), undef, 'revision_prop: nonexistent');
# TEST
like($fs->revision_prop(1, 'svn:date'), qr/^\d+-\d+-\d+T\d+:\d+:\d+\.\d+Z$/,
'revision_prop: svn:date');
# To create a revision property is a bit more difficult, because we have
# to set up a 'pre-revprop-change' hook script. These tests are skipped
# on systems on which I don't know how to do that.
SKIP: {
skip "don't know how to create 'pre-revprop-change' hook script on $^O", 3
if $^O eq 'MSWin32';
my $script_filename = "$repospath/hooks/pre-revprop-change";
open my $script, '>', $script_filename
or die "error creating hook script '$script_filename': $!";
print $script "#!/bin/sh\nexit 0\n";
close $script;
chmod 0755, $script_filename
or die "error making hook script '$script_filename' executable: $!";
$fs->change_rev_prop(1, 'test-prop', 'foo');
# TEST
is($fs->revision_prop(1, 'test-prop'), 'foo', 'change_rev_prop');
$fs->change_rev_prop(1, 'test-prop', undef);
# TEST
is($fs->revision_prop(1, 'test-prop'), undef, 'change_rev_prop: deleted');
$fs->change_rev_prop(1, 'binary-prop', $BINARY_DATA);
# TEST
is($fs->revision_prop(1, 'binary-prop'), $BINARY_DATA,
'change_rev_prop with binary data');
}
END {
diag "cleanup";
rmtree($repospath);
}
( run in 0.357 second using v1.01-cache-2.11-cpan-39bf76dae61 )