Skip to content

Commit

Permalink
Fix server version check in keys test
Browse files Browse the repository at this point in the history
git-svn-id: http://code.sixapart.com/svn/memcached/trunk/api/perl@825 b0b603af-a30f-0410-a34e-baf09ae79d0b
  • Loading branch information
ask committed Sep 21, 2009
1 parent eeb096b commit 4ffd810
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions t/02_keys.t
Expand Up @@ -5,6 +5,11 @@ use Test::More;
use Cache::Memcached;
use IO::Socket::INET;

unless ($^V) {
plan skip_all => "This test requires perl 5.6.0+\n";
exit 0;
}

my $testaddr = "127.0.0.1:11211";
my $msock = IO::Socket::INET->new(PeerAddr => $testaddr,
Timeout => 3);
Expand All @@ -22,7 +27,12 @@ my $memd = Cache::Memcached->new({

isa_ok($memd, 'Cache::Memcached');

my $memcached_version = $memd->stats('misc')->{hosts}->{$testaddr}->{misc}->{version};
my $memcached_version =
version->parse(
$memd->stats('misc')->{hosts}->{$testaddr}->{misc}->{version}
);

diag("Server version: $memcached_version");

ok($memd->set("key1", "val1"), "set key1 as val1");

Expand All @@ -40,7 +50,7 @@ ok(! $memd->get("key1"), "get key1 properly failed");

SKIP: {
skip "Only using prepend/append on memcached >= 1.2.4, you have $memcached_version", 7
unless $memcached_version ge 1.2.4; # this will fail horriby testing vZ.X.YY
unless $memcached_version >= v1.2.4; # this will fail horriby testing vZ.X.YY

ok(! $memd->append("key-noexist", "bogus"), "append key-noexist properly failed");
ok(! $memd->prepend("key-noexist", "bogus"), "prepend key-noexist properly failed");
Expand Down

0 comments on commit 4ffd810

Please sign in to comment.