File: 02readwrite.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 (31 lines) | stat: -rw-r--r-- 569 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
26
27
28
29
30
31
use Test::More tests=>4; 
use Logger::Simple;

my $logfile="t/logfile2";

my $log=Logger::Simple->new(LOG=>$logfile);

$log->write("Test");
ok(-s $logfile,'Writing to logfile');

my $MSG=$log->retrieve_history;
ok($MSG eq "Test");

$log->write("Test2");
$log->write("Test3");

my @Msg=$log->retrieve_history;
ok(scalar @Msg == 3);

$log->clear_history;
my @Msg2=$log->retrieve_history;
ok(scalar @Msg2 == 0);

undef $log;

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