source: ProjectBuilder/devel/pb-modules/t/Log.t@ 2275

Last change on this file since 2275 was 2275, checked in by Bruno Cornec, 7 years ago

Fix tests so that they really work when Test::More isn't found

File size: 1.5 KB
Line 
1#!/usr/bin/perl -w
2#
3# Tests ProjectBuilder::Log functions
4
5use strict;
6use ProjectBuilder::Base;
7
8my $res;
9eval
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
21if ($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
30is("tmp", "tmp", "temp test");
31done_testing(1);
32exit(0);
33
34use ProjectBuilder::Log;
35
36my $nt = 0;
37# Acquires test data
38my $logf = "combined.log";
39if (!open(FILE, "< $logf")) {
40 die("Could not open file $logf\n");
41}
42my @lines = <FILE>;
43close(FILE);
44
45my $log = new ProjectBuilder::Log;
46$log->setCompleteLog(join("\n", @lines));
47my $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
54my ($scheme, $account, $host, $port, $path);
55foreach 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
68done_testing($nt);
Note: See TracBrowser for help on using the repository browser.