Permalink
Browse files

Add tests for 2.6.9 client {set,get}name commands

Signed-off-by: Pedro Melo <melo@simplicidade.org>
  • Loading branch information...
1 parent 11ca249 commit 7af9dd7f13f2d761b285fba2df02be3c04597ab1 @melo melo committed Jan 15, 2013
Showing with 28 additions and 0 deletions.
  1. +28 −0 t/42-client_cmds.t
View
@@ -0,0 +1,28 @@
+#!perl
+
+use warnings;
+use strict;
+use Test::More;
+use Redis;
+use lib 't/tlib';
+use Test::SpawnRedisServer;
+
+my ($c, $srv) = redis(requires_version => '2.6.9');
+END { $c->() if $c }
+
+subtest 'client_{set|get}name commands' => sub {
+ ok(my $r = Redis->new(server => $srv), 'connected to our test redis-server');
+
+ my @clients = $r->client_list;
+ is(@clients, 1, 'one client listed');
+ like($clients[0], qr/\s+name=\s+/, '... no name set yet');
+
+ is($r->client_setname('my_preccccious'), 'OK', "client_setname() is supported, no errors");
+ is($r->client_getname, 'my_preccccious', '... client_getname() returns new connection name');
+
+ @clients = $r->client_list;
+ like($clients[0], qr/\s+name=my_preccccious\s+/, '... no name set yet');
+};
+
+
+done_testing();

0 comments on commit 7af9dd7

Please sign in to comment.