/[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 47 by dpavlin, Mon Mar 23 11:30:40 2009 UTC revision 48 by dpavlin, Mon Mar 23 11:33:21 2009 UTC
# Line 3  Line 3 
3  use warnings;  use warnings;
4  use strict;  use strict;
5    
6  use Test::More tests => 102;  use Test::More tests => 103;
7    
8  use lib 'lib';  use lib 'lib';
9    
# Line 15  ok( my $o = Redis->new(), 'new' ); Line 15  ok( my $o = Redis->new(), 'new' );
15    
16  ok( $o->ping, 'ping' );  ok( $o->ping, 'ping' );
17    
18    
19  diag "Commands operating on string values";  diag "Commands operating on string values";
20    
21  ok( $o->set( foo => 'bar' ), 'set foo => bar' );  ok( $o->set( foo => 'bar' ), 'set foo => bar' );
# Line 77  cmp_ok( $o->keys('key-*'), '==', $key_ne Line 78  cmp_ok( $o->keys('key-*'), '==', $key_ne
78  is_deeply( [ $o->keys('key-*') ], [ @keys ], 'keys' );  is_deeply( [ $o->keys('key-*') ], [ @keys ], 'keys' );
79    
80  ok( my $key = $o->randomkey, 'randomkey' );  ok( my $key = $o->randomkey, 'randomkey' );
 diag "key: $key";  
81    
82  ok( $o->rename( 'test-incrby', 'test-renamed' ), 'rename' );  ok( $o->rename( 'test-incrby', 'test-renamed' ), 'rename' );
83  ok( $o->exists( 'test-renamed' ), 'exists test-renamed' );  ok( $o->exists( 'test-renamed' ), 'exists test-renamed' );
# Line 86  eval { $o->rename( 'test-decrby', 'test- Line 86  eval { $o->rename( 'test-decrby', 'test-
86  ok( $@, 'rename to existing key' );  ok( $@, 'rename to existing key' );
87    
88  ok( my $nr_keys = $o->dbsize, 'dbsize' );  ok( my $nr_keys = $o->dbsize, 'dbsize' );
89  diag "dbsize: $nr_keys";  
90    
91  diag "Commands operating on lists";  diag "Commands operating on lists";
92    
# Line 162  ok( $o->exists( 'foo' ), 'exists' ); Line 162  ok( $o->exists( 'foo' ), 'exists' );
162  ok( $o->flushdb, 'flushdb' );  ok( $o->flushdb, 'flushdb' );
163  cmp_ok( $o->dbsize, '==', 0, 'empty' );  cmp_ok( $o->dbsize, '==', 0, 'empty' );
164    
165    
166  diag "Sorting";  diag "Sorting";
167    
168  ok( $o->lpush( 'test-sort', $_ ), "put $_" ) foreach ( 1 .. 4 );  ok( $o->lpush( 'test-sort', $_ ), "put $_" ) foreach ( 1 .. 4 );
# Line 170  cmp_ok( $o->llen( 'test-sort' ), '==', 4 Line 171  cmp_ok( $o->llen( 'test-sort' ), '==', 4
171  is_deeply( [ $o->sort( 'test-sort' )      ], [ 1,2,3,4 ], 'sort' );  is_deeply( [ $o->sort( 'test-sort' )      ], [ 1,2,3,4 ], 'sort' );
172  is_deeply( [ $o->sort( 'test-sort DESC' ) ], [ 4,3,2,1 ], 'sort DESC' );  is_deeply( [ $o->sort( 'test-sort DESC' ) ], [ 4,3,2,1 ], 'sort DESC' );
173    
174    
175    diag "Persistence control commands";
176    
177    ok( $o->save, 'save' );
178    
179    
180  diag "Connection handling";  diag "Connection handling";
181    
182  ok( $o->quit, 'quit' );  ok( $o->quit, 'quit' );

Legend:
Removed from v.47  
changed lines
  Added in v.48

  ViewVC Help
Powered by ViewVC 1.1.26