Skip to content

Commit

Permalink
tests: minimize errors/warnings on Test::More <= 0.8.0
Browse files Browse the repository at this point in the history
Call note and explain as functions [i.e. with braces],
hide them behind if ($ENV{TEST_VERBOSE}).
  • Loading branch information
marschap committed Nov 17, 2012
1 parent 3448bab commit 4b0173f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion t/02filter.t
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ foreach $test (@tests) {

is($data, $binary, "$filter asn_dump");
unless($data eq $binary) {
note explain($filt);
note(explain($filt)) if ($ENV{TEST_VERBOSE});
print "got ", unpack("H*", $data), "\n";
asn_dump(\*STDOUT, $data);
print "wanted ", unpack("H*", $binary), "\n";
Expand Down
2 changes: 1 addition & 1 deletion t/04refloop.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $::destroy = 0;
{
my $ldap = Net::LDAP::Dummy->new("host", async => 1);
$ldap->bind; # create an internal ref loop
note explain($ldap->inner) if $ENV{TEST_VERBOSE};
note(explain($ldap->inner)) if $ENV{TEST_VERBOSE};
}
ok($::destroy, '');

Expand Down
4 changes: 2 additions & 2 deletions t/07filtermatch.t
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ isa_ok($schema, Net::LDAP::Schema, 'schema object created');

ok($schema->parse('data/schema.in'), "schema loaded: ".($schema->error ? $schema->error : ''));

note 'Schema: ', explain($schema);
note('Schema: ', explain($schema)) if ($ENV{TEST_VERBOSE});


foreach my $elem (@tests) {
my ($filterstring, $ops) = %{$elem};
my $filter = Net::LDAP::Filter->new($filterstring);
isa_ok($filter, Net::LDAP::Filter, 'filter object created');

#note "$filterstring => ", explain($filter);
#note("$filterstring => ", explain($filter));

for my $case (@testcases) {
my ($op) = grep(/^$case:/, @{$ops});
Expand Down
2 changes: 1 addition & 1 deletion t/60cancel.t
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ sub process_entry
my $m = shift;
my $e = shift;

note $m->mesg_id.':'.$e->dn() if (ref($e));
note($m->mesg_id.':'.$e->dn()) if ($ENV{TEST_VERBOSE} && ref($e));
}


8 changes: 4 additions & 4 deletions t/70sortctrl.t
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ SKIP: {

ok($resp && $resp->result == LDAP_SUCCESS , 'LDAP_CONTROL_SORTRESULT success');

#note $mesg->count;
if ($ENV{TEST_VERBOSE}) {
my $rank = 0;
foreach my $e ($mesg->entries) {
note join(':', map { join(',',$e->get_value($_)) } @attrs);
note(++$rank, '. ', join(':', map { join(',',$e->get_value($_)) } @attrs));
}
}

Expand All @@ -91,10 +91,10 @@ SKIP: {

ok($resp && $resp->result == LDAP_SUCCESS , 'LDAP_CONTROL_SORTRESULT success');

#note $mesg->count;
if ($ENV{TEST_VERBOSE}) {
my $rank = 0;
foreach my $e (reverse $mesg->entries) {
note join(':', map { join(',',$e->get_value($_)) } @attrs);
note(++$rank,'. ',join(':', map { join(',',$e->get_value($_)) } @attrs));
}
}

Expand Down
2 changes: 1 addition & 1 deletion t/common.pl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ sub start_server {
mkdir($TESTDB, 0777);
die "$TESTDB is not a directory" unless -d $TESTDB;

note "@LDAPD" if $ENV{TEST_VERBOSE};
note("@LDAPD") if $ENV{TEST_VERBOSE};

my $log = $TEMPDIR . "/" . basename($0,'.t');

Expand Down

0 comments on commit 4b0173f

Please sign in to comment.