X-Git-Url: http://git.rot13.org/?p=perl-Redis.git;a=blobdiff_plain;f=t%2F01-Redis.t;h=d41bd3f7f9144c67e884a2daabd622b9875d8b53;hp=242a863346c82aa80492d46a00dac8e8e8cfa695;hb=7b6138898abd509437714737a314e455f77bc1e5;hpb=74f09579425ad6060edc98c31b7781b57c5fecde diff --git a/t/01-Redis.t b/t/01-Redis.t index 242a863..d41bd3f 100755 --- a/t/01-Redis.t +++ b/t/01-Redis.t @@ -3,7 +3,7 @@ use warnings; use strict; -use Test::More tests => 53; +use Test::More tests => 64; use lib 'lib'; @@ -78,4 +78,24 @@ ok( $@, 'rename to existing key' ); ok( my $nr_keys = $o->dbsize, 'dbsize' ); diag "dbsize: $nr_keys"; +diag "Commands operating on lists"; + +my $list = 'test-list'; + +$o->del($list) && diag "cleanup $list from last run"; + +ok( $o->rpush( $list => "r$_" ), 'rpush' ) foreach ( 1 .. 3 ); + +ok( $o->lpush( $list => "l$_" ), 'lpush' ) foreach ( 1 .. 2 ); + +cmp_ok( $o->llen($list), '==', 5, 'llen' ); + +is_deeply( [ $o->lrange( $list, 0, 1 ) ], [ 'l2', 'l1' ], 'lrange' ); + +ok( $o->ltrim( $list, 1, 2 ), 'ltrim' ); +cmp_ok( $o->llen($list), '==', 2, 'llen after ltrim' ); + +cmp_ok( $o->lindex( $list, 0 ), 'eq', 'l1', 'lindex' ); +cmp_ok( $o->lindex( $list, 1 ), 'eq', 'r1', 'lindex' ); + ok( $o->quit, 'quit' );