1 | #!/usr/bin/perl -w
|
---|
2 | #
|
---|
3 | # Tests ProjectBuilder::Log functions
|
---|
4 |
|
---|
5 | use strict;
|
---|
6 | use ProjectBuilder::Base;
|
---|
7 |
|
---|
8 | my $res;
|
---|
9 | eval
|
---|
10 | {
|
---|
11 | require Test::More;
|
---|
12 | Test::More->import();
|
---|
13 | $res = $@;
|
---|
14 | my ($tmv,$tmsv) = split(/\./,$Test::More::VERSION);
|
---|
15 | if ($tmsv lt 87) {
|
---|
16 | die "Test::More is not available in an appropriate version ($tmsv)";
|
---|
17 | }
|
---|
18 | };
|
---|
19 |
|
---|
20 | # Test::More not found so no test will be performed here
|
---|
21 | if ($res) {
|
---|
22 | require Test;
|
---|
23 | Test->import();
|
---|
24 | plan(tests => 1);
|
---|
25 | print "# Faking tests as test::More is not available in an appropriate version\n";
|
---|
26 | ok(1,1);
|
---|
27 | exit (0);
|
---|
28 | }
|
---|
29 |
|
---|
30 | is("tmp", "tmp", "temp test");
|
---|
31 | done_testing(1);
|
---|
32 | exit(0);
|
---|
33 |
|
---|
34 | use ProjectBuilder::Log;
|
---|
35 |
|
---|
36 | my $nt = 0;
|
---|
37 | # Acquires test data
|
---|
38 | my $logf = "combined.log";
|
---|
39 | if (!open(FILE, "< $logf")) {
|
---|
40 | die("Could not open file $logf\n");
|
---|
41 | }
|
---|
42 | my @lines = <FILE>;
|
---|
43 | close(FILE);
|
---|
44 |
|
---|
45 | my $log = new ProjectBuilder::Log;
|
---|
46 | $log->setCompleteLog(join("\n", @lines));
|
---|
47 | my $test = {
|
---|
48 | # Full URI
|
---|
49 | "svn+ssh://account\@machine.sdom.tld:8080/path/to/file" => ["svn+ssh","account","machine.sdom.tld","8080","/path/to/file"],
|
---|
50 | # Partial URI
|
---|
51 | "http://machine2/path1/to/anotherfile" => ["http","","machine2","","/path1/to/anotherfile"],
|
---|
52 | };
|
---|
53 |
|
---|
54 | my ($scheme, $account, $host, $port, $path);
|
---|
55 | foreach my $lines (split(/\n/,$log->summary)) {
|
---|
56 | #($scheme, $account, $host, $port, $path) = pb_get_uri($uri);
|
---|
57 |
|
---|
58 | #is($scheme, $test->{$uri}[0], "pb_get_uri Test protocol $uri");
|
---|
59 | #$nt++;
|
---|
60 |
|
---|
61 | }
|
---|
62 |
|
---|
63 | #$ENV{'TMPDIR'} = "/tmp";
|
---|
64 | #pb_temp_init();
|
---|
65 | #like($ENV{'PBTMP'}, qr|/tmp/pb\.[0-9A-z]+|, "pb_temp_init Test");
|
---|
66 | #$nt++;
|
---|
67 |
|
---|
68 | done_testing($nt);
|
---|