source: ProjectBuilder/devel/pb-modules/t/Base.t@ 1109

Last change on this file since 1109 was 1109, checked in by Bruno Cornec, 13 years ago

r4041@localhost: bruno | 2010-11-17 11:40:41 +0100

  • Adds new configuration parameters (oschkcmd, oschkopt) to externalize package checking command
  • Adds new configuration parameters (pbinstalltype, pbpkg) to start allowing installation of pb in VM/VE with packages or files (this last is only needed by upstream)
  • Remove dependency on Mail::Sendmail to where it's really needed (part of Log, not used yet, and annouce). In particular this removes one non std dep for VE/VM build.
File size: 1.5 KB
Line 
1#!/usr/bin/perl -w
2#
3# Tests ProjectBuilder::Base functions
4
5use strict;
6use ProjectBuilder::Base;
7
8eval
9{
10 require Test::More;
11 Test::More->import();
12};
13
14# Test::More not found so no test will be performed here
15if ($@) {
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
23my $nt = 0;
24my $test = {
25 # Full URI
26 "svn+ssh://account\@machine.sdom.tld:8080/path/to/file" => ["svn+ssh","account","machine.sdom.tld","8080","/path/to/file"],
27 # Partial URI
28 "http://machine2/path1/to/anotherfile" => ["http","","machine2","","/path1/to/anotherfile"],
29 };
30
31my ($scheme, $account, $host, $port, $path);
32foreach my $uri (keys %$test) {
33 ($scheme, $account, $host, $port, $path) = pb_get_uri($uri);
34
35 is($scheme, $test->{$uri}[0], "pb_get_uri Test protocol $uri");
36 $nt++;
37
38 is($account, $test->{$uri}[1], "pb_get_uri Test account $uri");
39 $nt++;
40
41 is($host, $test->{$uri}[2], "pb_get_uri Test host $uri");
42 $nt++;
43
44 is($port, $test->{$uri}[3], "pb_get_uri Test port $uri");
45 $nt++;
46
47 is($path, $test->{$uri}[4], "pb_get_uri Test path $uri");
48 $nt++;
49}
50
51$ENV{'TMPDIR'} = "/tmp";
52pb_temp_init();
53like($ENV{'PBTMP'}, qr|/tmp/pb\.[0-9A-z]+|, "pb_temp_init Test");
54$nt++;
55
56my $content = "This is content with TABs and spaces and \ncarriage returns\n";
57open(FILE,"> $ENV{'PBTMP'}/test") || die "Unable to create temp file";
58print FILE $content;
59close(FILE);
60
61my $cnt = pb_get_content("$ENV{'PBTMP'}/test");
62is($cnt, $content, "pb_get_content Test");
63$nt++;
64
65done_testing($nt);
Note: See TracBrowser for help on using the repository browser.