AnyEvent-Redis-RipeRedis
view release on metacpan or search on metacpan
t/01-accessors.t view on Meta::CPAN
use 5.008000;
use strict;
use warnings;
use lib 't/tlib';
use Test::More tests => 37;
use AnyEvent::Redis::RipeRedis qw( :err_codes );
my $REDIS = AnyEvent::Redis::RipeRedis->new(
password => 'test',
connection_timeout => 10,
read_timeout => 5,
reconnect => 1,
min_reconnect_interval => 5,
encoding => 'utf8',
on_connect => sub {
return 1;
},
on_disconnect => sub {
return 2;
},
on_connect_error => sub {
return 3;
},
on_error => sub {
return 4;
},
);
can_ok( $REDIS, 'connection_timeout' );
can_ok( $REDIS, 'read_timeout' );
can_ok( $REDIS, 'selected_database' );
can_ok( $REDIS, 'reconnect' );
can_ok( $REDIS, 'encoding' );
can_ok( $REDIS, 'on_connect' );
can_ok( $REDIS, 'on_disconnect' );
can_ok( $REDIS, 'on_connect_error' );
can_ok( $REDIS, 'on_error' );
t_conn_timeout($REDIS);
t_read_timeout($REDIS);
t_reconnect($REDIS);
t_min_reconnect_interval($REDIS);
t_encoding($REDIS);
t_on_connect($REDIS);
t_on_disconnect($REDIS);
t_on_connect_error($REDIS);
t_on_error($REDIS);
t_selected_database($REDIS);
sub t_conn_timeout {
my $redis = shift;
my $t_conn_timeout = $redis->connection_timeout;
is( $t_conn_timeout, 10, "get 'connection_timeout'" );
$redis->connection_timeout(undef);
is( $redis->connection_timeout, undef,
"reset to default 'connection_timeout'" );
( run in 0.795 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )