/[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 3 by dpavlin, Sat Mar 21 21:40:53 2009 UTC revision 7 by dpavlin, Sat Mar 21 22:38:56 2009 UTC
# Line 3  Line 3 
3  use warnings;  use warnings;
4  use strict;  use strict;
5    
6  use Test::More tests => 6;  use Test::More tests => 28;
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  ok( $o->set( foo => 'bar' ), 'set foo' );  ok( $o->set( foo => 'bar' ), 'set foo => bar' );
19  cmp_ok( $o->get( 'foo' ), 'eq', 'bar', 'get foo' );  
20    eval { $o->set( foo => 'bar', 1 ) };
21    ok( $@, 'set foo => bar new again failed' );
22    
23    cmp_ok( $o->get( 'foo' ), 'eq', 'bar', 'get foo = bar' );
24    
25    ok( $o->set( foo => 'baz' ), 'set foo => baz' );
26    
27    cmp_ok( $o->get( 'foo' ), 'eq', 'baz', 'get foo = baz' );
28    
29    ok( ! $o->get( 'non-existant' ), 'get non-existant' );
30    
31    ok( $o->set('key-next' => 0), 'key-next = 0' );
32    
33    my $key_next = 3;
34    
35    foreach ( 0 .. $key_next ) {
36            ok(     $o->set( "key-$_" => $_ ),           "set key-$_" );
37            cmp_ok( $o->get( "key-$_"       ), 'eq', $_, "get key-$_" );
38            cmp_ok( $o->incr( 'key-next' ), '==', $_ + 1, 'incr' );
39    }
40    
41    cmp_ok( $o->get( 'key-next' ), '==', $key_next + 1, 'key-next' );
42    
43    ok( $o->set('test-incrby', 0), 'test-incrby' );
44    foreach ( 1 .. 3 ) {
45            cmp_ok( $o->incr('test-incrby', 3), '==', $_ * 3, 'incrby 3' );
46    }
47    
48  ok( $o->quit, 'quit' );  ok( $o->quit, 'quit' );

Legend:
Removed from v.3  
changed lines
  Added in v.7

  ViewVC Help
Powered by ViewVC 1.1.26