use warnings;
use strict;
-use Test::More tests => 110;
+use Test::More tests => 111;
+use Test::Exception;
use Data::Dumper;
use lib 'lib';
cmp_ok( $o->get( 'foo' ), 'eq', 'bar', 'get foo = bar' );
+ok( $o->set( foo => '' ), 'set foo => ""' );
+
+cmp_ok( $o->get( 'foo' ), 'eq', '', 'get foo = ""' );
+
ok( $o->set( foo => 'baz' ), 'set foo => baz' );
cmp_ok( $o->get( 'foo' ), 'eq', 'baz', 'get foo = baz' );
cmp_ok( $o->get( 'utf8' ), 'eq', $euro, 'get utf8' );
ok( $o->set( 'test-undef' => 42 ), 'set test-undef' );
-ok( $o->set( 'test-undef' => undef ), 'set undef' );
-ok( ! defined $o->get( 'test-undef' ), 'get undef' );
ok( $o->exists( 'test-undef' ), 'exists undef' );
$o->del('non-existant');
cmp_ok( $o->llen( 'test-sort' ), '==', 4, 'llen' );
is_deeply( [ $o->sort( 'test-sort' ) ], [ 1,2,3,4 ], 'sort' );
-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' );
diag "Persistence control commands";
diag "Connection handling";
ok( $o->quit, 'quit' );
+
+throws_ok sub { Redis->new(server => '127.0.0.1:1') },
+ qr/Could not connect to Redis server at 127[.]0[.]0[.]1:1:/,
+ 'Failed connection throws exception';