document and test redis object for issuing normal commands
[perl-Redis.git] / t / 20-Redis-Hash.t
index 4bef8a5..660c8f3 100755 (executable)
@@ -3,7 +3,7 @@
 use warnings;
 use strict;
 
-use Test::More tests => 7;
+use Test::More tests => 8;
 use lib 'lib';
 use Data::Dump qw/dump/;
 
@@ -11,20 +11,20 @@ BEGIN {
        use_ok( 'Redis::Hash' );
 }
 
-my $h;
-
-ok( my $o = tie( %$h, 'Redis::Hash', 'test-redis-hash' ), 'tie' );
+ok( my $o = tie( my %h, 'Redis::Hash', 'test-redis-hash' ), 'tie' );
 
 isa_ok( $o, 'Redis::Hash' );
 
-$h = {};
+$o->CLEAR();
+
+ok( ! keys %h, 'empty' );
 
-ok( ! %$h, 'empty' );
+ok( %h = ( 'foo' => 42, 'bar' => 1, 'baz' => 99 ), '=' );
 
-ok( $h = { 'foo' => 42, 'bar' => 1, 'baz' => 99 }, '=' );
+is_deeply( [ sort keys %h ], [ 'bar', 'baz', 'foo' ], 'keys' );
 
-is_deeply( $h, { bar => 1, baz => 99, foo => 42 }, 'values' );
+is_deeply( \%h, { bar => 1, baz => 99, foo => 42, }, 'structure' );
 
-is_deeply( [ keys %$h ], [ 'bar', 'baz', 'foo' ], 'keys' );
+ok( my $mem = $o->info->{used_memory}, 'info' );
+diag "used memory $mem";
 
-diag dump( $h );