X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=t%2F20-Redis-Hash.t;fp=t%2F20-Redis-Hash.t;h=4bef8a54748338b22aacc909c152f0e10f626d69;hb=16b05e03b2a90f65f103553d934858d974ee808d;hp=0000000000000000000000000000000000000000;hpb=b8ff672c10960796e47cb49ff17473f2bb136375;p=perl-Redis.git diff --git a/t/20-Redis-Hash.t b/t/20-Redis-Hash.t new file mode 100755 index 0000000..4bef8a5 --- /dev/null +++ b/t/20-Redis-Hash.t @@ -0,0 +1,30 @@ +#!/usr/bin/perl + +use warnings; +use strict; + +use Test::More tests => 7; +use lib 'lib'; +use Data::Dump qw/dump/; + +BEGIN { + use_ok( 'Redis::Hash' ); +} + +my $h; + +ok( my $o = tie( %$h, 'Redis::Hash', 'test-redis-hash' ), 'tie' ); + +isa_ok( $o, 'Redis::Hash' ); + +$h = {}; + +ok( ! %$h, 'empty' ); + +ok( $h = { 'foo' => 42, 'bar' => 1, 'baz' => 99 }, '=' ); + +is_deeply( $h, { bar => 1, baz => 99, foo => 42 }, 'values' ); + +is_deeply( [ keys %$h ], [ 'bar', 'baz', 'foo' ], 'keys' ); + +diag dump( $h );