~svn/ubuntu/raring/subversion/ppa

« back to all changes in this revision

Viewing changes to subversion/bindings/swig/perl/native/t/4pool.t

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-12-05 01:26:14 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051205012614-qom4xfypgtsqc2xq
Tags: 1.2.3dfsg1-3ubuntu1
Merge with the final Debian release of 1.2.3dfsg1-3, bringing in
fixes to the clean target, better documentation of the libdb4.3
upgrade and build fixes to work with swig1.3_1.3.27.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
use strict;
 
3
use Test::More tests => 6;
 
4
use File::Path q(rmtree);
 
5
use File::Temp qw(tempdir);
 
6
 
 
7
# shut up about variables that are only used once.
 
8
# these come from constants and variables used
 
9
# by the bindings but not elsewhere in perl space.
 
10
no warnings 'once'; 
 
11
 
 
12
require SVN::Core;
 
13
require SVN::Repos;
 
14
require SVN::Fs;
 
15
require SVN::Delta;
 
16
 
 
17
package TestEditor;
 
18
our @ISA = qw(SVN::Delta::Editor);
 
19
 
 
20
sub add_directory {
 
21
    my ($self, $path, undef, undef, undef, $pool) = @_;
 
22
    $pool->default;
 
23
    main::is_pool_default ($pool, 'default pool from c calls');
 
24
}
 
25
 
 
26
package main;
 
27
sub is_pool_default {
 
28
    my ($pool, $text) = @_;
 
29
    is (ref ($pool) eq 'SVN::Pool' ? $$$pool : $$pool,
 
30
        $$SVN::_Core::current_pool, $text);
 
31
}
 
32
 
 
33
my $repospath = tempdir('svn-perl-test-XXXXXX', TMPDIR => 1);
 
34
 
 
35
my $repos;
 
36
 
 
37
ok($repos = SVN::Repos::create("$repospath", undef, undef, undef, undef),
 
38
   "create repository at $repospath");
 
39
 
 
40
my $fs = $repos->fs;
 
41
 
 
42
my $pool = SVN::Pool->new_default;
 
43
 
 
44
is_pool_default ($pool, 'default pool');
 
45
 
 
46
{
 
47
    my $spool = SVN::Pool->new_default_sub;
 
48
    is_pool_default ($spool, 'lexical default pool default');
 
49
}
 
50
 
 
51
is_pool_default ($pool, 'lexical default pool destroyed');
 
52
 
 
53
my $root = $fs->revision_root (0);
 
54
 
 
55
my $txn = $fs->begin_txn(0);
 
56
 
 
57
$txn->root->make_dir('trunk');
 
58
 
 
59
$txn->commit;
 
60
 
 
61
 
 
62
SVN::Repos::dir_delta ($root, '', '',
 
63
                       $fs->revision_root (1), '',
 
64
                       TestEditor->new(),
 
65
                       undef, 1, 1, 0, 1);
 
66
 
 
67
 
 
68
is_pool_default ($pool, 'default pool from c calls destroyed');
 
69
 
 
70
END {
 
71
diag('cleanup');
 
72
rmtree($repospath);
 
73
}