Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Skip scripting tests if redis-server found lack scripting support

Signed-off-by: Pedro Melo <melo@simplicidade.org>
  • Loading branch information...
commit 8db20406e61ff8967dbc9722ae3a77f12e8d7cc7 1 parent 6e43ef4
@melo melo authored
Showing with 8 additions and 7 deletions.
  1. +1 −0  Changes
  2. +7 −7 t/30-scripts.t
View
1  Changes
@@ -1,6 +1,7 @@
Revision history for Redis
{{$NEXT}}
+ * Skip 30-scripts.t if the redis-server found lacks script support
1.954 2012-10-10T11:16:22Z
* Support for multi-word commands such as "SCRIPT LOAD".
View
14 t/30-scripts.t
@@ -12,21 +12,21 @@ use Digest::SHA1 qw(sha1_hex);
my ($c, $srv) = redis();
END { $c->() if $c }
+my $o = Redis->new(server => $srv);
+
+## Make sure SCRIPT commands are available
+eval { $o->script_flush };
+plan skip_all => 'This redis-server lacks scripting support' if $@ && $@ =~ /ERR unknown command 'SCRIPT',/;
-ok(my $o = Redis->new(server => $srv), 'connected to our test redis-server');
-ok($o->ping, 'ping');
## Commands related to Lua scripting
# Specifically, these commands test multi-word commands
-
ok($o->set(foo => 'bar'), 'set foo => bar');
-$o->script_flush;
-
-my $script = "return 1";
+my $script = "return 1";
my $script_sha = sha1_hex($script);
-my @ret = $o->script_exists($script_sha);
+my @ret = $o->script_exists($script_sha);
ok(@ret && $ret[0] == 0, "script exists returns false");
@ret = $o->script_load($script);
ok(@ret && $ret[0] eq $script_sha, "script load returns the sha1 of the script");
Please sign in to comment.
Something went wrong with that request. Please try again.