1#!/usr/local/bin/perl -w 2 3BEGIN { 4 if($ENV{INTERNAL_DEBUG}) { 5 require Log::Log4perl::InternalDebug; 6 Log::Log4perl::InternalDebug->enable(); 7 } 8} 9 10use strict; 11use warnings; 12use Test::More; 13use Log::Log4perl::Config::Watch; 14 15plan tests => 4; 16 17my $EG_DIR = "eg"; 18$EG_DIR = "../eg" unless -d $EG_DIR; 19 20 # sample file to run tests on 21my $file = "$EG_DIR/log4j-manual-1.conf"; 22 23my $w = Log::Log4perl::Config::Watch->new( 24 file => $file, 25 signal => 'USR1', 26); 27 28$w->change_detected(); 29$Log::Log4perl::Config::Watch::L4P_TEST_CHANGE_DETECTED = 0; 30$Log::Log4perl::Config::Watch::L4P_TEST_CHANGE_CHECKED = 0; 31$w->change_detected(); 32 33is($Log::Log4perl::Config::Watch::L4P_TEST_CHANGE_CHECKED, 34 0, "no change checked without signal"); 35is($Log::Log4perl::Config::Watch::L4P_TEST_CHANGE_DETECTED, 36 0, "no change detected without signal"); 37 38$w->force_next_check(); 39$w->change_detected(); 40 41is($Log::Log4perl::Config::Watch::L4P_TEST_CHANGE_CHECKED, 42 1, "change checked after force_next_check()"); 43is($Log::Log4perl::Config::Watch::L4P_TEST_CHANGE_DETECTED, 44 0, "no change detected after force_next_check()"); 45