File: 03lock.t

package info (click to toggle)
liblogger-simple-perl 2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 88 kB
  • sloc: perl: 105; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 516 bytes parent folder | download | duplicates (2)
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
use Test::More;
use Logger::Simple;

if($^O eq "MSWin32"){
  plan( skip_all => 'File Locking not working on MS Windows' );
}else{
  plan (tests => 2);
  $logfile="t/logfile3";
  $logger=Logger::Simple->new(LOG=>$logfile);

  $logger->lock;
  ok(-e ".LS.lock",'Lock file created');

  $logger->unlock;
  ok(!-e ".LS.lock",'Lock file destroyed');

  undef $logger;

  if($^O eq 'MSWin32'){
    system "C:\\Windows\\System32\\cmd.exe \/c del t\\logfile3";
  }else{ 
    unlink $logfile;
  }
}