1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
use 5.010_000;
use strict;
use utf8;
use File::Temp qw(tempdir);
use File::Spec::Functions;
use Digest::MD5 qw(md5_hex);
use Glib qw(TRUE FALSE);
use IO::Socket::UNIX;
use Test::More tests => 3;
require_ok ('Clawsker');
my ($dirok, $dirko);
BEGIN {
my $tempdir = tempdir (CLEANUP => 1);
$dirok = catfile ($tempdir, 'ok');
mkdir $dirok;
$dirko = catfile ($tempdir, 'ko');
mkdir $dirko;
my $md5 = md5_hex ($ENV{HOME} . '/.claws-mail');
my $path = catfile ($dirok, $md5);
my $sock = IO::Socket::UNIX->new(
Type => SOCK_STREAM(), Local => $path, Listen => 1
);
}
use Clawsker;
is (
Clawsker::has_claws_socket ($dirok), TRUE,
'ok has it'
);
is (
Clawsker::has_claws_socket ($dirko), FALSE,
'ko does not'
);
|