Changeset 1077 in ProjectBuilder


Ignore:
Timestamp:
Jul 26, 2010, 1:18:52 AM (14 years ago)
Author:
Bruno Cornec
Message:

r3961@localhost: bruno | 2010-07-22 22:39:23 +0200

  • Increase number of tests for Base
Location:
devel/pb-modules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/lib/ProjectBuilder/Base.pm

    r1076 r1077  
    402402
    403403This function checks that the commands needed for the subsystem are indeed present.
    404 The required comands are passed as a coma separated string as first parameter.
    405 The optional comands are passed as a coma separated string as second parameter.
     404The required commands are passed as a coma separated string as first parameter.
     405The optional commands are passed as a coma separated string as second parameter.
    406406
    407407=cut
  • devel/pb-modules/t/Base.t

    r1076 r1077  
    88
    99my $nt = 0;
     10my $test = {
     11    # Full URI
     12    "svn+ssh://account\@machine.sdom.tld:8080/path/to/file" => ["svn+ssh","account","machine.sdom.tld","8080","/path/to/file"],
     13    # Partial URI
     14    "http://machine2/path1/to/anotherfile" => ["http","","machine2","","/path1/to/anotherfile"],
     15    };
    1016
    11 my $uri = "svn+ssh://account\@machine.sdom.tld:8080/path/to/file";
    12 my ($scheme, $account, $host, $port, $path) = pb_get_uri($uri);
     17my ($scheme, $account, $host, $port, $path);
     18foreach my $uri (keys %$test) {
     19    ($scheme, $account, $host, $port, $path) = pb_get_uri($uri);
    1320
    14 is($scheme, "svn+ssh", "pb_get_uri Test protocol");
     21    is($scheme, $test->{$uri}[0], "pb_get_uri Test protocol $uri");
     22    $nt++;
     23
     24    is($account, $test->{$uri}[1], "pb_get_uri Test account $uri");
     25    $nt++;
     26   
     27    is($host, $test->{$uri}[2], "pb_get_uri Test host $uri");
     28    $nt++;
     29   
     30    is($port, $test->{$uri}[3], "pb_get_uri Test port $uri");
     31    $nt++;
     32   
     33    is($path, $test->{$uri}[4], "pb_get_uri Test path $uri");
     34    $nt++;
     35}
     36
     37$ENV{'TMPDIR'} = "/tmp";
     38pb_temp_init();
     39like($ENV{'PBTMP'}, qr|/tmp/pb\.[0-9A-z]+|, "pb_temp_init Test");
    1540$nt++;
    1641
    17 is($account, "account", "pb_get_uri Test account");
    18 $nt++;
     42my $content = "This is  content with TABs    and spaces and \ncarriage returns\n";
     43open(FILE,"> $ENV{'PBTMP'}/test") || die "Unable to create temp file";
     44print FILE $content;
     45close(FILE);
    1946
    20 is($host, "machine.sdom.tld", "pb_get_uri Test host");
    21 $nt++;
    22 
    23 is($port, "8080", "pb_get_uri Test port");
    24 $nt++;
    25 
    26 is($path, "/path/to/file", "pb_get_uri Test path");
     47my $cnt = pb_get_content("$ENV{'PBTMP'}/test");
     48is($cnt, $content, "pb_get_content Test");
    2749$nt++;
    2850
Note: See TracChangeset for help on using the changeset viewer.