"Fossies" - the Fresh Open Source Software Archive

Member "memcached-1.6.15/t/unixsocket.t" (21 Feb 2022, 742 Bytes) of package /linux/www/memcached-1.6.15.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl
    2 
    3 use strict;
    4 use Test::More;
    5 use FindBin qw($Bin);
    6 use lib "$Bin/lib";
    7 use MemcachedTest;
    8 
    9 my $filename = "/tmp/memcachetest$$";
   10 
   11 if (supports_unix_socket()) {
   12     plan tests => 3;
   13 
   14     my $server = new_memcached("-s $filename");
   15     my $sock = $server->sock;
   16 
   17     ok(-S $filename, "creating unix domain socket $filename");
   18 
   19     # set foo (and should get it)
   20     print $sock "set foo 0 0 6\r\nfooval\r\n";
   21 
   22     is(scalar <$sock>, "STORED\r\n", "stored foo");
   23     mem_get_is($sock, "foo", "fooval");
   24 
   25     unlink($filename);
   26 
   27     ## Just some basic stuff for now...
   28 } else {
   29     plan tests => 1;
   30 
   31     eval {
   32         my $server = new_memcached("-s $filename");
   33     };
   34     ok($@, "Died connecting to unsupported unix socket.");
   35 }