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 |
|
|
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' ); |
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' ); |
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 |
|
|
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 ); |
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' ); |