source: trunk/soft/ObsData/t/OR-02.t @ 31

Last change on this file since 31 was 31, checked in by thauvin, 19 years ago
  • adding loging functions
  • Property cvs2svn:cvs-rev set to 1.2
  • Property svn:keywords set to Author Date Id Revision
  • Property svn:mime-type set to text/x-troff
File size: 845 bytes
Line 
1
2# $Id$
3
4use Test::More tests => 6;
5use File::Temp qw(tempdir);
6use ObsData::Repository;
7
8{
9my $td = tempdir;
10ok(ObsData::Repository::init_repository($td), "Can initialize repos data");
11ok(-f "$td/obsdata.db", "db is really create");
12ok(-d "$td/logs", "log directory exists");
13
14ok(ObsData::Repository->new(configfile => 'testdata/obsdata-conftest', dir => $td), "Can create object");
15
16my $odr = ObsData::Repository->new(
17    configfile => 'testdata/obsdata-conftest', dir => $td,
18    sublog => sub {
19        ok($_[0] eq "INFO", "Log Callback give good loglevel");
20        ok($_[2] eq "LOG MSG", "Log Callback give good message");
21    },
22);
23
24$odr->logmsg('INFO', undef, "LOG %s", 'MSG');
25# DEBUG msg are filtrered, so if more test are run, there is a pb here
26$odr->logmsg('DEBUG', undef, "LOG %s", 'MSG');
27$odr = undef;
28
29system("rm -fr $td");
30}
Note: See TracBrowser for help on using the repository browser.