3 |
use warnings; |
use warnings; |
4 |
use strict; |
use strict; |
5 |
|
|
6 |
use Test::More tests => 103; |
use Test::More tests => 106; |
7 |
|
use Data::Dump qw/dump/; |
8 |
|
|
9 |
use lib 'lib'; |
use lib 'lib'; |
10 |
|
|
21 |
|
|
22 |
ok( $o->set( foo => 'bar' ), 'set foo => bar' ); |
ok( $o->set( foo => 'bar' ), 'set foo => bar' ); |
23 |
|
|
24 |
eval { $o->set( foo => 'bar', 1 ) }; |
ok( ! $o->setnx( foo => 'bar' ), 'setnx foo => bar fails' ); |
|
ok( $@, 'set foo => bar new again failed' ); |
|
25 |
|
|
26 |
cmp_ok( $o->get( 'foo' ), 'eq', 'bar', 'get foo = bar' ); |
cmp_ok( $o->get( 'foo' ), 'eq', 'bar', 'get foo = bar' ); |
27 |
|
|
32 |
ok( $o->set( 'test-undef' => 42 ), 'set test-undef' ); |
ok( $o->set( 'test-undef' => 42 ), 'set test-undef' ); |
33 |
ok( $o->set( 'test-undef' => undef ), 'set undef' ); |
ok( $o->set( 'test-undef' => undef ), 'set undef' ); |
34 |
ok( ! defined $o->get( 'test-undef' ), 'get undef' ); |
ok( ! defined $o->get( 'test-undef' ), 'get undef' ); |
|
diag $o->exists( 'test-undef' ); |
|
35 |
ok( $o->exists( 'test-undef' ), 'exists undef' ); |
ok( $o->exists( 'test-undef' ), 'exists undef' ); |
36 |
|
|
37 |
$o->del('non-existant'); |
$o->del('non-existant'); |
64 |
ok( $o->set('test-incrby', 0), 'test-incrby' ); |
ok( $o->set('test-incrby', 0), 'test-incrby' ); |
65 |
ok( $o->set('test-decrby', 0), 'test-decry' ); |
ok( $o->set('test-decrby', 0), 'test-decry' ); |
66 |
foreach ( 1 .. 3 ) { |
foreach ( 1 .. 3 ) { |
67 |
cmp_ok( $o->incr('test-incrby', 3), '==', $_ * 3, 'incrby 3' ); |
cmp_ok( $o->incrby('test-incrby', 3), '==', $_ * 3, 'incrby 3' ); |
68 |
cmp_ok( $o->decr('test-decrby', 7), '==', -( $_ * 7 ), 'decrby 7' ); |
cmp_ok( $o->decrby('test-decrby', 7), '==', -( $_ * 7 ), 'decrby 7' ); |
69 |
} |
} |
70 |
|
|
71 |
ok( $o->del( $_ ), "del $_" ) foreach map { "key-$_" } ( 'next', 'left' ); |
ok( $o->del( $_ ), "del $_" ) foreach map { "key-$_" } ( 'next', 'left' ); |
174 |
diag "Persistence control commands"; |
diag "Persistence control commands"; |
175 |
|
|
176 |
ok( $o->save, 'save' ); |
ok( $o->save, 'save' ); |
177 |
|
ok( $o->bgsave, 'bgsave' ); |
178 |
|
ok( $o->lastsave, 'lastsave' ); |
179 |
|
#ok( $o->shutdown, 'shutdown' ); |
180 |
|
diag "shutdown not tested"; |
181 |
|
|
182 |
|
diag "Remote server control commands"; |
183 |
|
|
184 |
|
ok( my $info = $o->info, 'info' ); |
185 |
|
diag dump( $info ); |
186 |
|
|
187 |
diag "Connection handling"; |
diag "Connection handling"; |
188 |
|
|