File: 002_config.t.PL

package info (click to toggle)
libsvn-notify-mirror-perl 0.04000-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 284 kB
  • sloc: perl: 1,167; makefile: 4
file content (78 lines) | stat: -r--r--r-- 1,578 bytes parent folder | download | duplicates (4)
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
68
69
70
71
72
73
74
75
76
77
78
use Module::Build;
my $mb = Module::Build->current();
exit(0) unless $mb->feature('config_support');

use Cwd;
my ($testconfig, $maintest, $subtest) = (shift, shift, shift);
my $PWD = getcwd;

# setup the configuration file
open my $FILE, '>', $testconfig;
print {$FILE} <<"EOF";
#!/usr/bin/perl -MSVN::Notify::Config=\$0
--- #YAML:1.0
'':
  PATH: "/usr/local/bin:/usr/bin"
'/project1/branches/branch1':
  handler: Mirror
  to: "$PWD/t/wc-branch/"
EOF

if ( $mb->feature('ssh_support') and $mb->notes('sshtests') ) {
    print {$FILE} <<"EOF";
'/project1/trunk':
  handler: Mirror::SSH
  to: "$PWD/t/wc-trunk/"
  minimal: 1
  ssh-host: localhost
'/project1/tags':
  handler: Mirror::SSH
  to: "$PWD/t/wc-tag/"
  tag-regex: 'TRUNK'
  ssh-host: localhost
EOF
}
else {
    print {$FILE} <<"EOF";
'/project1/trunk':
  handler: Mirror
  minimal: 1
  to: "$PWD/t/wc-trunk/"
'/project1/tags':
  handler: Mirror
  to: "$PWD/t/wc-tag/"
  tag-regex: 'TRUNK'
EOF
}
close $FILE;

open my $FILE, '>', $subtest;
print {$FILE} <<"EOF";
#!/usr/bin/perl -w
# We have to go through this roundabout method because
# SVN::Notify::Config->import() won't run with -I on the
# command line and because it calls exit at the end
BEGIN {
    unshift \@INC, "blib/lib", "blib/arch";
}

my (\$repos_path, \$rev) = (shift, shift);

require SVN::Notify::Config;
push \@ARGV, \$repos_path, \$rev;
SVN::Notify::Config->import(
	"$testconfig"
);
EOF

close $FILE;

open my $FILE, '>', $maintest;
print {$FILE} <<"EOF";
require "t/coretests.pm";

reset_all_tests();
run_tests("perl $subtest");
EOF

close $FILE;