X-Git-Url: http://git.rot13.org/?p=perl-Redis.git;a=blobdiff_plain;f=t%2F01-Redis.t;h=714c898c80315fe5231ec500f0afd42d8eeae2af;hp=58dbdc423afb5fafed5b44458f192850660893d8;hb=d83b94045bd5ac5764d26319e03d1ee6c4266e63;hpb=9cfdc80967211c3b14fb981b5e0b012f43447599 diff --git a/t/01-Redis.t b/t/01-Redis.t index 58dbdc4..714c898 100755 --- a/t/01-Redis.t +++ b/t/01-Redis.t @@ -3,7 +3,7 @@ use warnings; use strict; -use Test::More tests => 56; +use Test::More tests => 62; use lib 'lib'; @@ -80,11 +80,19 @@ diag "dbsize: $nr_keys"; diag "Commands operating on lists"; -ok( $o->rpush( 'test-list' => 'foo' ), 'rpush' ); +my $list = 'test-list'; -ok( $o->lpush( 'test-list' => 'foo' ), 'lpush' ); +$o->del($list) && diag "cleanup $list from last run"; -cmp_ok( $o->llen('test-list'), '==', 2, 'llen' ); +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, 2, 3 ), 'ltrim' ); +cmp_ok( $o->llen($list), '==', 2, 'llen after ltrim' ); ok( $o->quit, 'quit' );