Changeset 5623
- Timestamp:
- 01/27/08 14:58:39 (5 years ago)
- Location:
- lang/perl/Cache-Memcached-LibMemcached/branch/perl-memcached/t
- Files:
-
- 7 modified
-
02_basic.t (modified) (1 diff)
-
04_get_multi.t (modified) (2 diffs)
-
05_sequence.t (modified) (1 diff)
-
10_interop.t (modified) (1 diff)
-
11_prepend.t (modified) (1 diff)
-
12_append.t (modified) (1 diff)
-
13_cas.t (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Cache-Memcached-LibMemcached/branch/perl-memcached/t/02_basic.t
r5617 r5623 23 23 } 24 24 25 { 25 TODO: { 26 local $TODO = "Memcached::libmemcached flags support required"; 26 27 $cache->set("foo", { bar => 1 }, 300); 27 28 my $val = $cache->get("foo"); -
lang/perl/Cache-Memcached-LibMemcached/branch/perl-memcached/t/04_get_multi.t
r5392 r5623 31 31 } 32 32 33 { 33 TODO: { 34 local $TODO = "Memcached::libmemcached flag support required"; 35 34 36 my $key = 'complex-get_multi'; 35 37 my %data = (foo => [ qw(1 2 3) ]); … … 39 41 my $h = $cache->get_multi($key); 40 42 41 use Data::Dumper;42 warn Dumper($h);43 43 is_deeply($h->{$key}, \%data); 44 44 -
lang/perl/Cache-Memcached-LibMemcached/branch/perl-memcached/t/05_sequence.t
r5392 r5623 2 2 use Test::More; 3 3 4 BEGIN 5 { 6 if (! $ENV{ MEMCACHED_SERVER } ) { 7 plan(skip_all => "Define MEMCACHED_SERVER (e.g. localhost:11211) to run this test"); 8 } else { 9 plan(tests => 13); 10 } 11 use_ok("Cache::Memcached::LibMemcached"); 12 } 4 plan(skip_all => "TODO"); 13 5 14 my $cache = Cache::Memcached::LibMemcached->new( { 15 servers => [ $ENV{ MEMCACHED_SERVER } ] 16 } ); 17 isa_ok($cache, "Cache::Memcached::LibMemcached"); 18 19 { 20 $cache->set("num", 0); 21 22 for my $i (1..10) { 23 my $num = $cache->incr("num"); 24 is($num, $i); 25 } 26 } 27 28 { 29 $cache->remove("num"); 30 ok( ! $cache->incr("num") ); 31 } 6 #BEGIN 7 #{ 8 # if (! $ENV{ MEMCACHED_SERVER } ) { 9 # plan(skip_all => "Define MEMCACHED_SERVER (e.g. localhost:11211) to run this test"); 10 # } else { 11 # plan(tests => 13); 12 # } 13 # use_ok("Cache::Memcached::LibMemcached"); 14 #} 15 # 16 #my $cache = Cache::Memcached::LibMemcached->new( { 17 # servers => [ $ENV{ MEMCACHED_SERVER } ] 18 #} ); 19 #isa_ok($cache, "Cache::Memcached::LibMemcached"); 20 # 21 #{ 22 # $cache->set("num", 0); 23 # 24 # for my $i (1..10) { 25 # my $num = $cache->incr("num"); 26 # is($num, $i); 27 # } 28 #} 29 # 30 #{ 31 # $cache->remove("num"); 32 # ok( ! $cache->incr("num") ); 33 #} -
lang/perl/Cache-Memcached-LibMemcached/branch/perl-memcached/t/10_interop.t
r5392 r5623 2 2 use Test::More; 3 3 4 BEGIN 5 { 6 eval "use Cache::Memcached"; 7 if ($@) { 8 plan( skip_all => "Cache::Memcached not available" ); 9 } elsif (! $ENV{ MEMCACHED_SERVER } ) { 10 plan(skip_all => "Define MEMCACHED_SERVER (e.g. localhost:11211) to run this test"); 11 } else { 12 plan(tests => 3); 13 } 14 use_ok("Cache::Memcached::LibMemcached"); 15 } 4 plan(skip_all => "TODO"); 16 5 17 my $memcached = Cache::Memcached->new({ 18 servers => [ $ENV{ MEMCACHED_SERVER } ], 19 compress_threshold => 1_000 20 }); 21 my $libmemcached = Cache::Memcached::LibMemcached->new( { 22 servers => [ $ENV{ MEMCACHED_SERVER } ], 23 compress_threshold => 1_000 24 } ); 25 26 { 27 my $data = "1" x 10_000; 28 29 $memcached->set("foo", $data); 30 is( $libmemcached->get("foo"), $data, "set via Cache::Memcached, retrieve via Cache::Memcached::LibMemcached"); 31 32 $libmemcached->set("foo", $data); 33 is( $memcached->get("foo"), $data, "set via Cache::Memcached::LibMemcached, retrieve via Cache::Memcached"); 34 35 } 36 6 #BEGIN 7 #{ 8 # eval "use Cache::Memcached"; 9 # if ($@) { 10 # plan( skip_all => "Cache::Memcached not available" ); 11 # } elsif (! $ENV{ MEMCACHED_SERVER } ) { 12 # plan(skip_all => "Define MEMCACHED_SERVER (e.g. localhost:11211) to run this test"); 13 # } else { 14 # plan(tests => 3); 15 # } 16 # use_ok("Cache::Memcached::LibMemcached"); 17 #} 18 # 19 #my $memcached = Cache::Memcached->new({ 20 # servers => [ $ENV{ MEMCACHED_SERVER } ], 21 # compress_threshold => 1_000 22 #}); 23 #my $libmemcached = Cache::Memcached::LibMemcached->new( { 24 # servers => [ $ENV{ MEMCACHED_SERVER } ], 25 # compress_threshold => 1_000 26 #} ); 27 # 28 #{ 29 # my $data = "1" x 10_000; 30 # 31 # $memcached->set("foo", $data); 32 # is( $libmemcached->get("foo"), $data, "set via Cache::Memcached, retrieve via Cache::Memcached::LibMemcached"); 33 # 34 # $libmemcached->set("foo", $data); 35 # is( $memcached->get("foo"), $data, "set via Cache::Memcached::LibMemcached, retrieve via Cache::Memcached"); 36 # 37 #} 38 # -
lang/perl/Cache-Memcached-LibMemcached/branch/perl-memcached/t/11_prepend.t
r5392 r5623 2 2 use Test::More; 3 3 4 BEGIN 5 { 6 if (! $ENV{ MEMCACHED_SERVER } ) { 7 plan(skip_all => "Define MEMCACHED_SERVER (e.g. localhost:11211) to run this test"); 8 } else { 9 plan(tests => 3); 10 } 11 use_ok("Cache::Memcached::LibMemcached"); 12 } 4 plan(skip_all => "TODO"); 13 5 14 my $cache = Cache::Memcached::LibMemcached->new( { 15 servers => [ $ENV{ MEMCACHED_SERVER } ] 16 } ); 17 isa_ok($cache, "Cache::Memcached::LibMemcached"); 18 19 # XXX The stats() method is half baked, and you should NOT be using it 20 # in your code! DON'T TRUST THIS CODE! 21 22 my $h = $cache->stats(); 23 my $version = $h->{hosts}->{ $ENV{ MEMCACHED_SERVER } }->{version}; 24 my ($major, $minor, $micro) = split(/\./, $version); 25 my $numified = $major + $minor / 1_000 + $micro / 1_000_000; 26 27 SKIP: { 28 if ($numified < 1.002004) { 29 skip("Remote memcached version is $version, need at least 1.2.4 to run this test", 1); 30 } 31 32 $cache->set("foo", "abc"); 33 $cache->prepend("foo", "0123"); 34 is($cache->get("foo"), "0123abc"); 35 } 6 #BEGIN 7 #{ 8 # if (! $ENV{ MEMCACHED_SERVER } ) { 9 # plan(skip_all => "Define MEMCACHED_SERVER (e.g. localhost:11211) to run this test"); 10 # } else { 11 # plan(tests => 3); 12 # } 13 # use_ok("Cache::Memcached::LibMemcached"); 14 #} 15 # 16 #my $cache = Cache::Memcached::LibMemcached->new( { 17 # servers => [ $ENV{ MEMCACHED_SERVER } ] 18 #} ); 19 #isa_ok($cache, "Cache::Memcached::LibMemcached"); 20 # 21 ## XXX The stats() method is half baked, and you should NOT be using it 22 ## in your code! DON'T TRUST THIS CODE! 23 # 24 #my $h = $cache->stats(); 25 #my $version = $h->{hosts}->{ $ENV{ MEMCACHED_SERVER } }->{version}; 26 #my ($major, $minor, $micro) = split(/\./, $version); 27 #my $numified = $major + $minor / 1_000 + $micro / 1_000_000; 28 # 29 #SKIP: { 30 # if ($numified < 1.002004) { 31 # skip("Remote memcached version is $version, need at least 1.2.4 to run this test", 1); 32 # } 33 # 34 # $cache->set("foo", "abc"); 35 # $cache->prepend("foo", "0123"); 36 # is($cache->get("foo"), "0123abc"); 37 #} -
lang/perl/Cache-Memcached-LibMemcached/branch/perl-memcached/t/12_append.t
r5392 r5623 2 2 use Test::More; 3 3 4 BEGIN 5 { 6 if (! $ENV{ MEMCACHED_SERVER } ) { 7 plan(skip_all => "Define MEMCACHED_SERVER (e.g. localhost:11211) to run this test"); 8 } else { 9 plan(tests => 3); 10 } 11 use_ok("Cache::Memcached::LibMemcached"); 12 } 4 plan(skip_all => "TODO"); 13 5 14 my $cache = Cache::Memcached::LibMemcached->new( { 15 servers => [ $ENV{ MEMCACHED_SERVER } ] 16 } ); 17 isa_ok($cache, "Cache::Memcached::LibMemcached"); 18 19 # XXX The stats() method is half baked, and you should NOT be using it 20 # in your code! DON'T TRUST THIS CODE! 21 22 my $h = $cache->stats(); 23 my $version = $h->{hosts}->{ $ENV{ MEMCACHED_SERVER } }->{version}; 24 my ($major, $minor, $micro) = split(/\./, $version); 25 my $numified = $major + $minor / 1_000 + $micro / 1_000_000; 26 27 SKIP: { 28 if ($numified < 1.002004) { 29 skip("Remote memcached version is $version, need at least 1.2.4 to run this test", 1); 30 } 31 32 $cache->set("foo", "abc"); 33 $cache->append("foo", "0123"); 34 is($cache->get("foo"), "abc0123"); 35 } 6 #BEGIN 7 #{ 8 # if (! $ENV{ MEMCACHED_SERVER } ) { 9 # plan(skip_all => "Define MEMCACHED_SERVER (e.g. localhost:11211) to run this test"); 10 # } else { 11 # plan(tests => 3); 12 # } 13 # use_ok("Cache::Memcached::LibMemcached"); 14 #} 15 # 16 #my $cache = Cache::Memcached::LibMemcached->new( { 17 # servers => [ $ENV{ MEMCACHED_SERVER } ] 18 #} ); 19 #isa_ok($cache, "Cache::Memcached::LibMemcached"); 20 # 21 ## XXX The stats() method is half baked, and you should NOT be using it 22 ## in your code! DON'T TRUST THIS CODE! 23 # 24 #my $h = $cache->stats(); 25 #my $version = $h->{hosts}->{ $ENV{ MEMCACHED_SERVER } }->{version}; 26 #my ($major, $minor, $micro) = split(/\./, $version); 27 #my $numified = $major + $minor / 1_000 + $micro / 1_000_000; 28 # 29 #SKIP: { 30 # if ($numified < 1.002004) { 31 # skip("Remote memcached version is $version, need at least 1.2.4 to run this test", 1); 32 # } 33 # 34 # $cache->set("foo", "abc"); 35 # $cache->append("foo", "0123"); 36 # is($cache->get("foo"), "abc0123"); 37 #} -
lang/perl/Cache-Memcached-LibMemcached/branch/perl-memcached/t/13_cas.t
r5392 r5623 2 2 use Test::More; 3 3 4 BEGIN 5 { 6 if (! $ENV{ MEMCACHED_SERVER } ) { 7 plan(skip_all => "Define MEMCACHED_SERVER (e.g. localhost:11211) to run this test"); 8 } else { 9 plan(tests => 7); 10 } 11 use_ok("Cache::Memcached::LibMemcached"); 12 } 4 plan(skip_all => "TODO"); 13 5 14 my $cache = Cache::Memcached::LibMemcached->new( { 15 servers => [ $ENV{ MEMCACHED_SERVER } ], 16 support_cas => 1, 17 } ); 18 19 isa_ok($cache, "Cache::Memcached::LibMemcached"); 20 21 # XXX The stats() method is half baked, and you should NOT be using it 22 # in your code! DON'T TRUST THIS CODE! 23 24 my $h = $cache->stats(); 25 my $version = $h->{hosts}->{ $ENV{ MEMCACHED_SERVER } }->{version}; 26 my ($major, $minor, $micro) = split(/\./, $version); 27 my $numified = $major + $minor / 1_000 + $micro / 1_000_000; 28 29 SKIP: { 30 if ($numified < 1.002004) { 31 skip("Remote memcached version is $version, need at least 1.2.4 to run this test", 1); 32 } 33 34 my @keys = ('a' .. 'z'); 35 $cache->set($_, $_) for @keys; 36 my $cas = $cache->get_cas('a'); 37 ok($cas); 38 39 my $h = $cache->get_cas_multi(@keys); 40 ok($h); 41 isa_ok($h, 'HASH'); 42 43 is($h->{a}, $cas); 44 45 TODO: { 46 local $TODO = "cas() unconfirmed"; 47 my $newvalue = 'this used to be a'; 48 $cache->cas('a', $cas, $newvalue); 49 is($cache->get('a'), $newvalue); 50 } 51 } 6 #BEGIN 7 #{ 8 # if (! $ENV{ MEMCACHED_SERVER } ) { 9 # plan(skip_all => "Define MEMCACHED_SERVER (e.g. localhost:11211) to run this test"); 10 # } else { 11 # plan(tests => 7); 12 # } 13 # use_ok("Cache::Memcached::LibMemcached"); 14 #} 15 # 16 #my $cache = Cache::Memcached::LibMemcached->new( { 17 # servers => [ $ENV{ MEMCACHED_SERVER } ], 18 # support_cas => 1, 19 #} ); 20 # 21 #isa_ok($cache, "Cache::Memcached::LibMemcached"); 22 # 23 ## XXX The stats() method is half baked, and you should NOT be using it 24 ## in your code! DON'T TRUST THIS CODE! 25 # 26 #my $h = $cache->stats(); 27 #my $version = $h->{hosts}->{ $ENV{ MEMCACHED_SERVER } }->{version}; 28 #my ($major, $minor, $micro) = split(/\./, $version); 29 #my $numified = $major + $minor / 1_000 + $micro / 1_000_000; 30 # 31 #SKIP: { 32 # if ($numified < 1.002004) { 33 # skip("Remote memcached version is $version, need at least 1.2.4 to run this test", 1); 34 # } 35 # 36 # my @keys = ('a' .. 'z'); 37 # $cache->set($_, $_) for @keys; 38 # my $cas = $cache->get_cas('a'); 39 # ok($cas); 40 # 41 # my $h = $cache->get_cas_multi(@keys); 42 # ok($h); 43 # isa_ok($h, 'HASH'); 44 # 45 # is($h->{a}, $cas); 46 # 47 # TODO: { 48 # local $TODO = "cas() unconfirmed"; 49 # my $newvalue = 'this used to be a'; 50 # $cache->cas('a', $cas, $newvalue); 51 # is($cache->get('a'), $newvalue); 52 # } 53 #}
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)