projects
/
perl-indexdata-utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
452e430
)
Fix testing.
author
Mike Taylor
<mike@indexdata.com>
Tue, 9 Dec 2014 11:39:02 +0000
(11:39 +0000)
committer
Mike Taylor
<mike@indexdata.com>
Tue, 9 Dec 2014 11:39:02 +0000
(11:39 +0000)
t/02-IndexData-Utils-PersistentCounter.t
patch
|
blob
|
history
diff --git
a/t/02-IndexData-Utils-PersistentCounter.t
b/t/02-IndexData-Utils-PersistentCounter.t
index
d6930dc
..
a7752d6
100644
(file)
--- a/
t/02-IndexData-Utils-PersistentCounter.t
+++ b/
t/02-IndexData-Utils-PersistentCounter.t
@@
-1,7
+1,7
@@
use strict;
use warnings;
use strict;
use warnings;
-use Test::More tests => 15;
+use Test::More tests => 16;
BEGIN { use_ok('IndexData::Utils::PersistentCounter') };
my $file = "/tmp/id-u-pc-$$";
BEGIN { use_ok('IndexData::Utils::PersistentCounter') };
my $file = "/tmp/id-u-pc-$$";
@@
-12,15
+12,18
@@
$counter = new IndexData::Utils::PersistentCounter("/x/$file", 1);
ok(!defined $counter, "can't create counter in silly place");
$counter = new IndexData::Utils::PersistentCounter($file, 1);
ok(!defined $counter, "can't create counter in silly place");
$counter = new IndexData::Utils::PersistentCounter($file, 1);
-ok(defined $counter, "created new counter: $!");
+my $detail = defined $counter ? '' : ": $!@";
+ok(defined $counter, "created new counter$detail");
-foreach my $i (1..10) {
+foreach my $i (1..5) {
my $n = $counter->next();
my $n = $counter->next();
- is($n, $i);
+ ok(defined $n, "n is defined");
+ ok($n == $i, "n has correct value $i");
}
### should test access from multiple processes
}
### should test access from multiple processes
-$counter->delete();
+my $ok = $counter->delete();
+ok($ok, "deleted counter file");
$counter = new IndexData::Utils::PersistentCounter($file);
ok(!defined $counter, "can't open deleted counter");
$counter = new IndexData::Utils::PersistentCounter($file);
ok(!defined $counter, "can't open deleted counter");