Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tests: convert to Test::More

  • Loading branch information...
commit 5b98f6e2c42f3cb73b612fb178ac5ad97a2d65d2 1 parent c8d3ae8
@marschap marschap authored
View
23 t/00ldif-entry.t
@@ -4,8 +4,7 @@ BEGIN {
require "t/common.pl";
}
-
-print "1..16\n";
+use Test::More tests => 16;
use Net::LDAP::LDIF;
@@ -162,19 +161,13 @@ ok(!compare($cmpfile,$outfile), $cmpfile);
$e->add('name' => 'Graham Barr');
$e->add('name;en-us' => 'Bob');
-print "not " unless
-ok(
- join(":",sort $e->attributes)
- eq
- "associateddomain:counting:description:first:l:lastmodifiedby:lastmodifiedtime:name:name;en-us:o:postaladdress:second:st:streetaddress:telephonenumber",
- "attributes");
-
-print "not " unless
-ok(
- join(":",sort $e->attributes(nooptions => 1))
- eq
- "associateddomain:counting:description:first:l:lastmodifiedby:lastmodifiedtime:name:o:postaladdress:second:st:streetaddress:telephonenumber",
- "attributes - nooptions");
+is(join(":",sort $e->attributes),
+ "associateddomain:counting:description:first:l:lastmodifiedby:lastmodifiedtime:name:name;en-us:o:postaladdress:second:st:streetaddress:telephonenumber",
+ 'attributes');
+
+is(join(":",sort $e->attributes(nooptions => 1)),
+ "associateddomain:counting:description:first:l:lastmodifiedby:lastmodifiedtime:name:o:postaladdress:second:st:streetaddress:telephonenumber",
+ "attributes - nooptions");
$r = $e->get_value('name', asref => 1);
ok(($r and @$r == 1 and $r->[0] eq 'Graham Barr'), "name eq Graham Barr");
View
8 t/01canon_dn.t
@@ -1,5 +1,6 @@
#!perl
+use Test::More;
use Net::LDAP::Util qw(canonical_dn);
# Each line has an opcode and a DN, opcode are
@@ -10,8 +11,9 @@ use Net::LDAP::Util qw(canonical_dn);
my @tests = map { /^(\w+)\s+(.*)/ } <DATA>;
-print "1..", scalar(@tests)>>1, "\n";
-my $testno = 0;
+plan tests => scalar(@tests) >> 1;
+
+
my $refdn;
while(my($op,$dn) = splice(@tests,0,2)) {
@@ -50,7 +52,7 @@ while(my($op,$dn) = splice(@tests,0,2)) {
warn "Bad opcode $op\n";
}
- print +($failed ? "not ok " : "ok "),++$testno,"\n";
+ ok(!$failed, "$dn is " . (($op eq 'bad') ? 'illegal' : 'legal'));
}
View
30 t/02filter.t
@@ -1,6 +1,7 @@
#!perl
# Testcase contributed by Julian Onions <Julian.Onions@nexor.co.uk>
+use Test::More;
use Net::LDAP::Filter;
use Net::LDAP::ASN qw(Filter);
use Convert::ASN1 qw(asn_dump);
@@ -9,7 +10,9 @@ my $asn = $Filter;
my @tests = do { local $/=""; <DATA> };
-print "1..", 4*scalar(@tests), "\n";
+plan tests => 4 * scalar(@tests);
+
+
my $testno = 0;
my $test;
foreach $test (@tests) {
@@ -24,30 +27,23 @@ foreach $test (@tests) {
my $binary = pack("H*", join("", map { /\w+/g } $ber =~ /:((?: [\dA-Fa-f]{2}){1,16})/g));
- $testno ++;
- print "# ",$filter,"\n";
- $filt = new Net::LDAP::Filter $filter or print "not ";
- print "ok $testno\n";
- $testno ++;
- my $data = $asn->encode($filt) or print "# ",$asn->error,"\nnot ";
- print "ok $testno\n";
- $testno ++;
+ my $filt = new Net::LDAP::Filter $filter;
+ isa_ok($filt, Net::LDAP::Filter, "$filter");;
+
+ my $data = $asn->encode($filt);
+ ok($data, "$filter ASN.1 encode(".($asn->error || 0).')');
+
+ is($data, $binary, "$filter asn_dump");
unless($data eq $binary) {
- require Data::Dumper;
- print Data::Dumper::Dumper($filt);
+ note explain($filt);
print "got ", unpack("H*", $data), "\n";
asn_dump(\*STDOUT, $data);
print "wanted ", unpack("H*", $binary), "\n";
asn_dump(\*STDOUT, $binary);
-
- print "not "
}
- print "ok $testno\n";
- $testno ++;
my $str = $filt->as_string;
- print "# ", $str,"\nnot " unless $str eq $filter_out;
- print "ok $testno\n";
+ is($str, $filter_out, "$filter as_string");
}
__DATA__
View
28 t/03schema.t
@@ -1,40 +1,36 @@
#!perl -w
-use Net::LDAP::Schema;
-print "1..7\n";
+use Test::More tests => 7;
+use Net::LDAP::Schema;
my $schema = Net::LDAP::Schema->new( "data/schema.in" ) or die "Cannot open schema";
-print "ok 1\n";
+isa_ok($schema, Net::LDAP::Schema, 'load schema file');
my @atts = $schema->all_attributes();
-print "not " unless @atts == 55;
-print "ok 2\n";
-
+is(@atts, 55, 'number of attribute types in schema');
print "The schema contains ", scalar @atts, " attributes\n";
my @ocs = $schema->all_objectclasses();
-print "not " unless @ocs == 22;
-print "ok 3\n";
+is(@ocs, 22, 'number of object classes in schema');
print "The schema contains ", scalar @ocs, " object classes\n";
@atts = $schema->must( "person" );
-print "not " unless join(' ', sort map $_->{name}, @atts) eq join(' ',sort qw(cn sn objectClass));
-print "ok 4\n";
+is(join(' ', sort map $_->{name}, @atts), join(' ',sort qw(cn sn objectClass)), 'mandatory attributes');
print "The 'person' OC must have these attributes [",
join( ",", map $_->{name}, @atts ),
"]\n";
+
@atts = $schema->may( "mhsOrganizationalUser" );
-print "not " if @atts;
-print "ok 5\n";
+ok(!@atts, 'optional attributes');
print "The 'mhsOrganizationalUser' OC may have these attributes [",
join( ",", map $_->{name}, @atts ),
"]\n";
-print "not " if defined $schema->attribute('distinguishedName')->{max_length};
-print "ok 6\n";
+ok(! defined($schema->attribute('distinguishedName')->{max_length}), 'infinite length attribute type');
-print "not " unless $schema->attribute('userPassword')->{max_length} == 128;
-print "ok 7\n";
+is($schema->attribute('userPassword')->{max_length}, 128, 'attribute type max. length');
use Data::Dumper;
print Dumper($schema);
+
+0;
View
26 t/04refloop.t
@@ -1,24 +1,24 @@
#!perl
+use Test::More;
+
use Net::LDAP qw(LDAP_UNAVAILABLE);
my $devnull = eval { require File::Spec; File::Spec->devnull } || "/dev/null";
-unless (-e $devnull) {
- print "1..0 # Skip no null device\n";
- exit;
-}
-print "1..5\n";
+(-e $devnull)
+? plan tests => 5
+: plan skip_all => 'no null device';
+
$::destroy = 0;
{
my $ldap = Net::LDAP::Dummy->new("host", async => 1);
$ldap->bind; # create an internal ref loop
- require Data::Dumper, print Data::Dumper::Dumper($ldap->inner)
- if $ENV{TEST_VERBOSE};
+ note explain($ldap->inner) if $ENV{TEST_VERBOSE};
}
-print $::destroy ? "ok 1\n" : "not ok 1\n";
+ok($::destroy, '');
my $ref;
my $mesg;
@@ -27,13 +27,15 @@ $::destroy = 0;
my $ldap = Net::LDAP::Dummy->new("host", async => 1);
$mesg = $ldap->bind; # create an internal ref loop
$ref = $ldap->inner->outer;
- print +($ref == $ldap) ? "not ok 2\n" : "ok 2\n";
+ is($ref == $ldap, '');
}
-print $::destroy ? "not ok 3\n" : "ok 3\n";
+ok(!$::destroy, '');
+
$ref = undef;
-print +($mesg->code == LDAP_UNAVAILABLE) ? "ok 4\n" : "not ok 4\n";
+ok($mesg->code == LDAP_UNAVAILABLE, '');
+
undef $mesg;
-print $::destroy ? "ok 5\n" : "not ok 5\n";
+ok($::destroy, '');
package Net::LDAP::Dummy;
View
19 t/05dsml.t
@@ -1,26 +1,19 @@
#!perl
+use Test::More;
use File::Compare;
-BEGIN {
- require "t/common.pl";
-}
+BEGIN { require "t/common.pl" }
-unless (eval { require XML::SAX::Base; 1}) {
- print "1..0 # XML::SAX::Base not installed\n";
- exit;
-}
-unless (eval { require XML::SAX::Writer; 1}) {
- print "1..0 # XML::SAX::Writer not installed\n";
- exit;
-}
+(eval { require XML::SAX::Base } && eval { require XML::SAX::Writer })
+? plan tests => 1
+: plan skip_all => 'XML::SAX::Base and XML::SAX::Writer need to be installed';
+
require Net::LDAP::LDIF;
require Net::LDAP::DSML;
-print "1..1\n";
-
my $infile = "data/00-in.ldif";
my $outfile1 = "$TEMPDIR/05-out1.dsml";
my $cmpfile1 = "data/05-cmp.dsml";
View
11 t/06constant.t
@@ -1,5 +1,7 @@
#!perl -w
+use Test::More;
+
BEGIN {
for (1,2) { require Net::LDAP::Constant; }
}
@@ -107,12 +109,13 @@ my @constant = qw(
LDAP_REFERRAL_LIMIT_EXCEEDED
);
-print "1..", scalar(@constant),"\n";
+plan tests => scalar(@constant);
+
+
my $i = 0;
-while(my $const = $constant[$i]) {
+while (my $const = $constant[$i]) {
my $name = ldap_error_name($i);
$const = sprintf("LDAP error code %d(0x%02X)",$i,$i) unless $const =~ /\D/;
- print "not " if !$name or $name ne $const;
+ ok($name && $name eq $const, "$const");
++$i;
- print "ok $i # $name $const\n";
}
View
13 t/40connect.t
@@ -1,11 +1,14 @@
#!perl
-BEGIN {
- require "t/common.pl";
- start_server();
-}
+use Test::More;
+
+BEGIN { require "t/common.pl" }
+
+
+start_server()
+? plan tests => 3
+: plan skip_all => 'no server';
-print "1..3\n";
$ldap = client();
ok($ldap, 'client with IPv4/IPv6 auto-selection' .
View
13 t/41populate.t
@@ -1,11 +1,14 @@
#!perl
-BEGIN {
- require "t/common.pl";
- start_server();
-}
+use Test::More;
+
+BEGIN { require "t/common.pl" }
+
+
+start_server()
+? plan tests => 7
+: plan skip_all => 'no server';
-print "1..7\n";
$ldap = client();
ok($ldap, "client");
View
13 t/42search.t
@@ -1,11 +1,14 @@
#!perl
-BEGIN {
- require "t/common.pl";
- start_server();
-}
+use Test::More;
+
+BEGIN { require "t/common.pl" }
+
+
+start_server()
+? plan tests => 15
+: plan skip_all => 'no server';
-print "1..15\n";
$ldap = client();
ok($ldap, "client");
View
13 t/43modify.t
@@ -1,11 +1,14 @@
#!perl
-BEGIN {
- require "t/common.pl";
- start_server();
-}
+use Test::More;
+
+BEGIN { require "t/common.pl" }
+
+
+start_server()
+? plan tests => 7
+: plan skip_all => 'no server';
-print "1..7\n";
$ldap = client();
ok($ldap, "client");
View
13 t/44schema.t
@@ -1,11 +1,14 @@
#!perl
-BEGIN {
- require "t/common.pl";
- start_server(version => 3);
-}
+use Test::More;
+
+BEGIN { require "t/common.pl" }
+
+
+start_server(version => 3)
+? plan tests => 4
+: plan skip_all => 'no server';
-print "1..4\n";
$ldap = client();
ok($ldap, "client");
View
13 t/45dse.t
@@ -1,11 +1,14 @@
#!perl
-BEGIN {
- require "t/common.pl";
- start_server(version => 3);
-}
+use Test::More;
+
+BEGIN { require "t/common.pl" }
+
+
+start_server(version => 3)
+? plan tests => 4
+: plan skip_all => 'no server';
-print "1..4\n";
$ldap = client();
ok($ldap, "client");
View
57 t/46ssl.t
@@ -1,46 +1,47 @@
#!perl
-BEGIN {
- require "t/common.pl";
-}
+use Test::More;
-unless (eval { require IO::Socket::SSL; 1} ) {
- print "1..0 # IO::Socket::SSL not installed\n";
- exit;
-}
+BEGIN { require "t/common.pl" }
-start_server(version => 3, ssl => 1);
-print "1..15\n";
+start_server(version => 3, ssl => 1)
+? plan tests => 15
+: plan skip_all => 'no server';
-$ldap = client();
-ok($ldap, "client");
-$mesg = $ldap->bind($MANAGERDN, password => $PASSWD, version => 3);
+SKIP: {
+ skip('IO::Socket::SSL not installed', 15)
+ unless (eval { require IO::Socket::SSL; } );
-ok(!$mesg->code, "bind: " . $mesg->code . ": " . $mesg->error);
+ $ldap = client();
+ ok($ldap, "client");
-ok(ldif_populate($ldap, "data/40-in.ldif"), "data/40-in.ldif");
+ $mesg = $ldap->bind($MANAGERDN, password => $PASSWD, version => 3);
-$mesg = $ldap->start_tls;
-ok(!$mesg->code, "start_tls: " . $mesg->code . ": " . $mesg->error);
+ ok(!$mesg->code, "bind: " . $mesg->code . ": " . $mesg->error);
-$mesg = $ldap->start_tls;
-ok($mesg->code, "start_tls: " . $mesg->code . ": " . $mesg->error);
+ ok(ldif_populate($ldap, "data/40-in.ldif"), "data/40-in.ldif");
-$mesg = $ldap->search(base => $BASEDN, filter => 'objectclass=*');
-ok(!$mesg->code, "search: " . $mesg->code . ": " . $mesg->error);
+ $mesg = $ldap->start_tls;
+ ok(!$mesg->code, "start_tls: " . $mesg->code . ": " . $mesg->error);
-compare_ldif("40",$mesg,$mesg->sorted);
+ $mesg = $ldap->start_tls;
+ ok($mesg->code, "start_tls: " . $mesg->code . ": " . $mesg->error);
-$ldap = client(ssl => 1);
-ok($ldap, "ssl client");
+ $mesg = $ldap->search(base => $BASEDN, filter => 'objectclass=*');
+ ok(!$mesg->code, "search: " . $mesg->code . ": " . $mesg->error);
-$mesg = $ldap->start_tls;
-ok($mesg->code, "start_tls: " . $mesg->code . ": " . $mesg->error);
+ compare_ldif("40",$mesg,$mesg->sorted);
-$mesg = $ldap->search(base => $BASEDN, filter => 'objectclass=*');
-ok(!$mesg->code, "search: " . $mesg->code . ": " . $mesg->error);
+ $ldap = client(ssl => 1);
+ ok($ldap, "ssl client");
-compare_ldif("40",$mesg,$mesg->sorted);
+ $mesg = $ldap->start_tls;
+ ok($mesg->code, "start_tls: " . $mesg->code . ": " . $mesg->error);
+ $mesg = $ldap->search(base => $BASEDN, filter => 'objectclass=*');
+ ok(!$mesg->code, "search: " . $mesg->code . ": " . $mesg->error);
+
+ compare_ldif("40",$mesg,$mesg->sorted);
+}
View
13 t/47ipc.t
@@ -1,11 +1,14 @@
#!perl
-BEGIN {
- require "t/common.pl";
- start_server(ipc => 1);
-}
+use Test::More;
+
+BEGIN { require "t/common.pl" }
+
+
+start_server(ipc => 1)
+? plan tests => 18
+: plan skip_all => 'no server';
-print "1..12\n";
$ldap = client();
ok($ldap, "client");
View
14 t/48url.t
@@ -1,19 +1,19 @@
#!perl
-BEGIN {
- require "t/common.pl";
- start_server();
-}
+use Test::More;
+
+BEGIN { require "t/common.pl" }
-my $num_tests = @URL * 5 + 7;
-print "1..$num_tests\n";
+start_server()
+? plan tests => scalar(@URL) * 5 + 7
+: plan skip_all => 'no server';
+
$ldap = client();
ok($ldap, "client");
$mesg = $ldap->bind($MANAGERDN, password => $PASSWD);
-
ok(!$mesg->code, "bind: " . $mesg->code . ": " . $mesg->error);
ok(ldif_populate($ldap, "data/40-in.ldif"), "data/40-in.ldif");
View
49 t/49lwp.t
@@ -1,35 +1,37 @@
#!perl
-BEGIN {
- unless (eval { require LWP::UserAgent; 1 }) {
- print "1..0 # Skip Need LWP::UserAgent\n";
- exit;
- }
- require "t/common.pl";
- start_server();
-}
+use Test::More;
+
+BEGIN { require "t/common.pl" }
+
+start_server()
+? plan tests => 6
+: plan skip_all => 'no server';
-print "1..6\n";
-$ldap = client();
-ok($ldap, "client");
+SKIP: {
+ skip('LWP::UserAgent not installed', 6)
+ unless (eval { require LWP::UserAgent });
-$mesg = $ldap->bind($MANAGERDN, password => $PASSWD);
+ $ldap = client();
+ ok($ldap, "client");
-ok(!$mesg->code, "bind: " . $mesg->code . ": " . $mesg->error);
+ $mesg = $ldap->bind($MANAGERDN, password => $PASSWD);
-ok(ldif_populate($ldap, "data/41-in.ldif"), "data/41-in.ldif");
+ ok(!$mesg->code, "bind: " . $mesg->code . ": " . $mesg->error);
-my $ua = LWP::UserAgent->new;
-my $res;
+ ok(ldif_populate($ldap, "data/41-in.ldif"), "data/41-in.ldif");
+
+ my $ua = LWP::UserAgent->new;
+ my $res;
# now search the database
-$res = $ua->get("ldap://${HOST}:$PORT/$BASEDN??sub?sn=jensen");
-ok($res->content =~ /2 Matches found/);
+ $res = $ua->get("ldap://${HOST}:$PORT/$BASEDN??sub?sn=jensen");
+ ok($res->content =~ /2 Matches found/);
-my $expect = <<'LDIF';
+ my $expect = <<'LDIF';
version: 1
dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,o=Universit
@@ -74,11 +76,12 @@ facsimileTelephoneNumber: +1 313 555 2177
telephoneNumber: +1 313 555 0355
LDIF
-$res = $ua->get("ldap://${HOST}:$PORT/$BASEDN??sub?(sn=jensen)", Accept => 'text/ldif');
-is($res->content,$expect,'ldif result');
+ $res = $ua->get("ldap://${HOST}:$PORT/$BASEDN??sub?(sn=jensen)", Accept => 'text/ldif');
+ is($res->content,$expect,'ldif result');
-$res = $ua->get("ldap://${HOST}:$PORT/$BASEDN??sub?(sn=jensen)?x-format=ldif");
-is($res->content,$expect,'ldif result');
+ $res = $ua->get("ldap://${HOST}:$PORT/$BASEDN??sub?(sn=jensen)?x-format=ldif");
+ is($res->content,$expect,'ldif result');
+}
__END__
View
75 t/70sortctrl.t
@@ -24,6 +24,8 @@
use vars qw(%sortctrl);
+use Test::More tests => 9;
+
BEGIN { require "t/common.pl" }
use Net::LDAP::LDIF;
@@ -34,75 +36,60 @@ use Net::LDAP::Constant qw(
LDAP_SUCCESS
);
-unless ($EXTERNAL_TESTS) {
- print "1..0 # Skip External tests disabled\n";
- exit 0;
-}
+SKIP: {
+ skip('External tests disabled', 9) unless ($EXTERNAL_TESTS);
-my($host, $base, $filter, $order) = @sortctrl{qw(host base filter order)};
+ my($host, $base, $filter, $order) = @sortctrl{qw(host base filter order)};
-my $ldap = $host && Net::LDAP->new($host, version => 3);
+ my $ldap = $host && Net::LDAP->new($host, version => 3);
-unless ($ldap) {
- print "1..0 # Skip Cannot connect to host\n";
- exit 0;
-}
+ skip('Cannot connect to host', 9) unless ($ldap);
-my $dse = $ldap && $ldap->root_dse;
+ my $dse = $ldap && $ldap->root_dse;
-unless ($dse and grep { $_ eq LDAP_CONTROL_SORTREQUEST } $dse->get_value('supportedControl')) {
- print "1..0 # Skip server does not support LDAP_CONTROL_SORTREQUEST\n";
- exit;
-}
+ skip('server does not support LDAP_CONTROL_SORTREQUEST', 9)
+ unless ($dse and grep { $_ eq LDAP_CONTROL_SORTREQUEST } $dse->get_value('supportedControl'));
-print "1..9\n";
-Net::LDAP::LDIF->new(qw(- w))->write_entry($dse);
+ Net::LDAP::LDIF->new(qw(- w))->write_entry($dse);
-my $sort = Net::LDAP::Control::Sort->new(order => $order) or print "not ";
-print "ok 1\n";
+ my $sort = Net::LDAP::Control::Sort->new(order => $order);
+ isa_ok($sort, Net::LDAP::Control::Sort, 'Net::LDAP::Control::Sort object');
-my $mesg = $ldap->search(
+ my $mesg = $ldap->search(
base => $base,
control => [$sort],
filter => $filter,
);
+ is($mesg->code, LDAP_SUCCESS, 'search result');
-print "not " if $mesg->code;
-print "ok 2\n";
+ my ($resp) = $mesg->control( LDAP_CONTROL_SORTRESULT );
+ ok($resp, 'LDAP_CONTROL_SORTRESULT response');
-my ($resp) = $mesg->control( LDAP_CONTROL_SORTRESULT ) or print "not ";
-print "ok 3\n";
+ ok($resp && $resp->result == LDAP_SUCCESS , 'LDAP_CONTROL_SORTRESULT success');
-$resp && $resp->result == LDAP_SUCCESS or print "not ";
-print "ok 4\n";
+ print "# ",$mesg->count,"\n";
-print "# ",$mesg->count,"\n";
+ my $dn1 = join ";", map { $_->dn } $mesg->entries;
-my $dn1 = join ";", map { $_->dn } $mesg->entries;
+ $sort = Net::LDAP::Control::Sort->new(order => "-$order");
+ isa_ok($sort, Net::LDAP::Control::Sort, 'Net::LDAP::Control::Sort object (reversse order)');
-$sort = Net::LDAP::Control::Sort->new(order => "-$order") or print "not ";
-print "ok 5\n";
-
-$mesg = $ldap->search(
+ $mesg = $ldap->search(
base => $base,
control => [$sort],
filter => $filter,
);
+ is($mesg->code, LDAP_SUCCESS, 'search result');
-print "not " if $mesg->code;
-print "ok 6\n";
-
-($resp) = $mesg->control( LDAP_CONTROL_SORTRESULT ) or print "not ";
-print "ok 7\n";
+ ($resp) = $mesg->control( LDAP_CONTROL_SORTRESULT );
+ ok($resp, 'LDAP_CONTROL_SORTRESULT response');
-$resp && $resp->result == LDAP_SUCCESS or print "not ";
-print "ok 8\n";
+ ok($resp && $resp->result == LDAP_SUCCESS , 'LDAP_CONTROL_SORTRESULT success');
-print "# ",$mesg->count,"\n";
+ print "# ",$mesg->count,"\n";
-my $dn2 = join ";", map { $_->dn } reverse $mesg->entries;
-
-print "not " unless $dn1 eq $dn2;
-print "ok 9\n";
+ my $dn2 = join ";", map { $_->dn } reverse $mesg->entries;
+ is($dn1, $dn2, 'sort order');
+}
View
47 t/common.pl
@@ -53,6 +53,7 @@ BEGIN
die "$TEMPDIR is not a directory" unless -d $TEMPDIR;
}
+use Test::More;
use Net::LDAP;
use Net::LDAP::LDIF;
use Net::LDAP::Util qw(canonical_dn);
@@ -65,14 +66,11 @@ BEGIN
sub start_server {
my %arg = (version => 3, @_);
- unless ($LDAP_VERSION >= $arg{version}
+ return 0
+ unless ($LDAP_VERSION >= $arg{version}
and $LDAPD[0] and -x $LDAPD[0]
and (!$arg{ssl} or $SSL_PORT)
- and (!$arg{ipc} or $IPC_SOCK))
- {
- print "1..0 # Skip No server\n";
- exit;
- }
+ and (!$arg{ipc} or $IPC_SOCK));
if ($CONF_IN and -f $CONF_IN) {
# Create slapd config file
@@ -96,7 +94,7 @@ sub start_server {
mkdir($TESTDB, 0777);
die "$TESTDB is not a directory" unless -d $TESTDB;
- warn "@LDAPD" if $ENV{TEST_VERBOSE};
+ note "@LDAPD" if $ENV{TEST_VERBOSE};
my $log = $TEMPDIR . "/" . basename($0,'.t');
@@ -111,6 +109,7 @@ sub start_server {
}
sleep 2; # wait for server to start
+ return 1;
}
sub kill_server {
@@ -211,38 +210,4 @@ sub ldif_populate {
$ok;
}
-my $number = 0;
-sub ok {
- my ($condition, $name) = @_;
-
- my $message = $condition ? "ok " : "not ok ";
- $message .= ++$number;
- $message .= " # $name" if defined $name;
- print $message, "\n";
- return $condition;
-}
-
-sub is {
- my ($got, $expected, $name) = @_;
-
- for ($got, $expected) {
- $_ = 'undef' unless defined $_;
- }
-
- unless (ok($got eq $expected, $name)) {
- warn "Got: '$got'\nExpected: '$expected'\n" . join(' ', caller) . "\n";
- }
-}
-
-sub skip {
- my ($reason, $num) = @_;
- $reason ||= '';
- $number ||= 1;
-
- for (1 .. $num) {
- $number++;
- print "ok $number # skip $reason\n";
- }
-}
-
1;
Please sign in to comment.
Something went wrong with that request. Please try again.