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