summaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-01-24 15:47:50 +0000
committerNicholas Clark <nick@ccl4.org>2011-01-24 16:28:55 +0000
commit1ec1a96ceb905288f53d7cd5d816bf290eb2ee3d (patch)
treed93c6fe78ef4d7bb842473f61e60491c5b811029 /dist
parent0407acb5f2d891b70e3bd5b9958c07a0f630019c (diff)
downloadperl-1ec1a96ceb905288f53d7cd5d816bf290eb2ee3d.tar.gz
Convert Storable's store.t to Test::More
The non-obvious reason for the test count increasing from 20 to 21 is that the file used to read: print "not " unless open(OUT, 'store'); binmode OUT; $r = fd_retrieve(::OUT); print "not " unless defined $r; print "ok 12\n";
Diffstat (limited to 'dist')
-rw-r--r--dist/Storable/t/store.t63
1 files changed, 22 insertions, 41 deletions
diff --git a/dist/Storable/t/store.t b/dist/Storable/t/store.t
index 9ca1f63724..be43299521 100644
--- a/dist/Storable/t/store.t
+++ b/dist/Storable/t/store.t
@@ -19,7 +19,7 @@ sub BEGIN {
use Storable qw(store retrieve store_fd nstore_fd fd_retrieve);
-print "1..20\n";
+use Test::More tests => 21;
$a = 'toto';
$b = \$a;
@@ -29,21 +29,18 @@ $c->{attribute} = 'attrval';
@a = ('first', undef, 3, -4, -3.14159, 456, 4.5,
$b, \$a, $a, $c, \$c, \%a);
-print "not " unless defined store(\@a, 'store');
-print "ok 1\n";
+isnt(store(\@a, 'store'), undef);
$dumped = &dump(\@a);
-print "ok 2\n";
+isnt($dumped, undef);
$root = retrieve('store');
-print "not " unless defined $root;
-print "ok 3\n";
+isnt($root, undef);
$got = &dump($root);
-print "ok 4\n";
+isnt($got, undef);
-print "not " unless $got eq $dumped;
-print "ok 5\n";
+is($got, $dumped);
1 while unlink 'store';
@@ -58,53 +55,37 @@ sub make {
package main;
$foo = FOO->make;
-print "not " unless $foo->store('store');
-print "ok 6\n";
+isnt($foo->store('store'), undef);
-print "not " unless open(OUT, '>>store');
-print "ok 7\n";
+isnt(open(OUT, '>>store'), undef);
binmode OUT;
-print "not " unless defined store_fd(\@a, ::OUT);
-print "ok 8\n";
-print "not " unless defined nstore_fd($foo, ::OUT);
-print "ok 9\n";
-print "not " unless defined nstore_fd(\%a, ::OUT);
-print "ok 10\n";
+isnt(store_fd(\@a, ::OUT), undef);
+isnt(nstore_fd($foo, ::OUT), undef);
+isnt(nstore_fd(\%a, ::OUT), undef);
-print "not " unless close(OUT);
-print "ok 11\n";
+isnt(close(OUT), undef);
-print "not " unless open(OUT, 'store');
-binmode OUT;
+isnt(open(OUT, 'store'), undef);
$r = fd_retrieve(::OUT);
-print "not " unless defined $r;
-print "ok 12\n";
-print "not " unless &dump($foo) eq &dump($r);
-print "ok 13\n";
+isnt($r, undef);
+is(&dump($r), &dump($foo));
$r = fd_retrieve(::OUT);
-print "not " unless defined $r;
-print "ok 14\n";
-print "not " unless &dump(\@a) eq &dump($r);
-print "ok 15\n";
+isnt($r, undef);
+is(&dump($r), &dump(\@a));
$r = fd_retrieve(main::OUT);
-print "not " unless defined $r;
-print "ok 16\n";
-print "not " unless &dump($foo) eq &dump($r);
-print "ok 17\n";
+isnt($r, undef);
+is(&dump($r), &dump($foo));
$r = fd_retrieve(::OUT);
-print "not " unless defined $r;
-print "ok 18\n";
-print "not " unless &dump(\%a) eq &dump($r);
-print "ok 19\n";
+isnt($r, undef);
+is(&dump($r), &dump(\%a));
eval { $r = fd_retrieve(::OUT); };
-print "not " unless $@;
-print "ok 20\n";
+isnt($@, '');
close OUT or die "Could not close: $!";
END { 1 while unlink 'store' }