use Data::Dumper instead of Data::Dump so all our dependencies are perl core modules
[perl-Redis.git] / t / 20-Redis-Hash.t
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 use Test::More tests => 8;
7 use lib 'lib';
8
9 BEGIN {
10         use_ok( 'Redis::Hash' );
11 }
12
13 ok( my $o = tie( my %h, 'Redis::Hash', 'test-redis-hash' ), 'tie' );
14
15 isa_ok( $o, 'Redis::Hash' );
16
17 $o->CLEAR();
18
19 ok( ! keys %h, 'empty' );
20
21 ok( %h = ( 'foo' => 42, 'bar' => 1, 'baz' => 99 ), '=' );
22
23 is_deeply( [ sort keys %h ], [ 'bar', 'baz', 'foo' ], 'keys' );
24
25 is_deeply( \%h, { bar => 1, baz => 99, foo => 42, }, 'structure' );
26
27 ok( my $mem = $o->info->{used_memory}, 'info' );
28 diag "used memory $mem";
29