Mercurial > hg > Cache-Memcached
comparison t/02_keys.t @ 2:f5cfb726ea65 default tip
Append/prepend commands.
NOTE: gzipping content may produce unpredictable results.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sun, 30 Sep 2007 18:01:41 +0400 |
parents | 17fc6afc155e |
children |
comparison
equal
deleted
inserted
replaced
1:d0f7d74f9ca5 | 2:f5cfb726ea65 |
---|---|
7 | 7 |
8 my $testaddr = "127.0.0.1:11211"; | 8 my $testaddr = "127.0.0.1:11211"; |
9 my $msock = IO::Socket::INET->new(PeerAddr => $testaddr, | 9 my $msock = IO::Socket::INET->new(PeerAddr => $testaddr, |
10 Timeout => 3); | 10 Timeout => 3); |
11 if ($msock) { | 11 if ($msock) { |
12 plan tests => 10; | 12 plan tests => 14; |
13 } else { | 13 } else { |
14 plan skip_all => "No memcached instance running at $testaddr\n"; | 14 plan skip_all => "No memcached instance running at $testaddr\n"; |
15 exit 0; | 15 exit 0; |
16 } | 16 } |
17 | 17 |
29 is($memd->get("key2"), "val2", "get worked"); | 29 is($memd->get("key2"), "val2", "get worked"); |
30 | 30 |
31 ok($memd->replace("key2", "val-replace"), "replace worked"); | 31 ok($memd->replace("key2", "val-replace"), "replace worked"); |
32 ok(! $memd->replace("key-noexist", "bogus"), "replace failed"); | 32 ok(! $memd->replace("key-noexist", "bogus"), "replace failed"); |
33 | 33 |
34 ok($memd->set("key1", "1"), "set before append/prepend"); | |
35 ok($memd->append("key1", "2"), "append worked"); | |
36 ok($memd->prepend("key1", "3"), "prepend worked"); | |
37 is($memd->get("key1"), "312", "append/prepend result check"); | |
38 | |
34 my $stats = $memd->stats; | 39 my $stats = $memd->stats; |
35 ok($stats, "got stats"); | 40 ok($stats, "got stats"); |
36 is(ref $stats, "HASH", "is a hashref"); | 41 is(ref $stats, "HASH", "is a hashref"); |
37 | 42 |
38 | 43 |