6a371ecd73b4275d926ab61cfe7f1d66dc50aff5
[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 => 7;
7 use lib 'lib';
8 use Data::Dump qw/dump/;
9
10 BEGIN {
11         use_ok( 'Redis::Hash' );
12 }
13
14 ok( my $o = tie( my %h, 'Redis::Hash', 'test-redis-hash' ), 'tie' );
15
16 isa_ok( $o, 'Redis::Hash' );
17
18 $o->CLEAR();
19
20 ok( ! keys %h, 'empty' );
21
22 ok( %h = ( 'foo' => 42, 'bar' => 1, 'baz' => 99 ), '=' );
23
24 is_deeply( [ sort keys %h ], [ 'bar', 'baz', 'foo' ], 'keys' );
25
26 is_deeply( \%h, { bar => 1, baz => 99, foo => 42, }, 'structure' );
27
28
29 diag dump( \%h );
30