/[Redis.pre-github]/t/01-Redis.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /t/01-Redis.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 24 by dpavlin, Sun Mar 22 13:18:11 2009 UTC revision 28 by dpavlin, Sun Mar 22 15:02:42 2009 UTC
# Line 3  Line 3 
3  use warnings;  use warnings;
4  use strict;  use strict;
5    
6  use Test::More tests => 66;  use Test::More tests => 75;
7    
8  use lib 'lib';  use lib 'lib';
9    
# Line 26  ok( $o->set( foo => 'baz' ), 'set foo => Line 26  ok( $o->set( foo => 'baz' ), 'set foo =>
26    
27  cmp_ok( $o->get( 'foo' ), 'eq', 'baz', 'get foo = baz' );  cmp_ok( $o->get( 'foo' ), 'eq', 'baz', 'get foo = baz' );
28    
29    ok( $o->set( 'test-undef' => 42 ), 'set test-undef' );
30    ok( $o->set( 'test-undef' => undef ), 'set undef' );
31    ok( ! defined $o->get( 'test-undef' ), 'get undef' );
32    diag $o->exists( 'test-undef' );
33    ok( $o->exists( 'test-undef' ), 'exists undef' );
34    
35  $o->del('non-existant');  $o->del('non-existant');
36    
37  ok( ! $o->exists( 'non-existant' ), 'exists non-existant' );  ok( ! $o->exists( 'non-existant' ), 'exists non-existant' );
# Line 88  ok( $o->rpush( $list => "r$_" ), 'rpush' Line 94  ok( $o->rpush( $list => "r$_" ), 'rpush'
94    
95  ok( $o->lpush( $list => "l$_" ), 'lpush' ) foreach ( 1 .. 2 );  ok( $o->lpush( $list => "l$_" ), 'lpush' ) foreach ( 1 .. 2 );
96    
97    cmp_ok( $o->type($list), 'eq', 'list', 'type' );
98  cmp_ok( $o->llen($list), '==', 5, 'llen' );  cmp_ok( $o->llen($list), '==', 5, 'llen' );
99    
100  is_deeply( [ $o->lrange( $list, 0, 1 ) ], [ 'l2', 'l1' ], 'lrange' );  is_deeply( [ $o->lrange( $list, 0, 1 ) ], [ 'l2', 'l1' ], 'lrange' );
# Line 101  cmp_ok( $o->lindex( $list, 1 ), 'eq', 'r Line 108  cmp_ok( $o->lindex( $list, 1 ), 'eq', 'r
108  ok( $o->lset( $list, 0, 'foo' ), 'lset' );  ok( $o->lset( $list, 0, 'foo' ), 'lset' );
109  cmp_ok( $o->lindex( $list, 0 ), 'eq', 'foo', 'verified' );  cmp_ok( $o->lindex( $list, 0 ), 'eq', 'foo', 'verified' );
110    
111    ok( $o->lrem( $list, 1, 'foo' ), 'lrem' );
112    cmp_ok( $o->llen( $list ), '==', 1, 'llen after lrem' );
113    
114    cmp_ok( $o->lpop( $list ), 'eq', 'r1', 'lpop' );
115    
116    ok( ! $o->rpop( $list ), 'rpop' );
117    
118  ok( $o->quit, 'quit' );  ok( $o->quit, 'quit' );

Legend:
Removed from v.24  
changed lines
  Added in v.28

  ViewVC Help
Powered by ViewVC 1.1.26