6 if(open(MACROS, 'macros.all')) {
7 @names = map {chomp;$_} <MACROS>;
9 plan tests => @names + 3;
11 plan skip_all => "can't read 'macros.all': $!"
16 eval "use Test::Exception"; my $has_test_exception = !$@;
18 # Testing error messages
20 skip "Test::Exception not available", 1 unless $has_test_exception;
24 Sys::Syslog::constant()
25 }, '/^Usage: Sys::Syslog::constant\(sv\)/',
26 "calling constant() with no argument");
30 like( Sys::Syslog::constant('This'),
31 '/^This is not a valid Sys::Syslog macro/',
32 "calling constant() with a non existing name" );
34 like( Sys::Syslog::constant('NOSUCHNAME'),
35 '/^NOSUCHNAME is not a valid Sys::Syslog macro/',
36 "calling constant() with a non existing name" );
40 for my $name (@names) {
41 like( Sys::Syslog::constant($name),
42 '/^(?:\d+|Your vendor has not defined Sys::Syslog macro '.$name.', used)$/',
43 "checking that $name is a number (".Sys::Syslog::constant($name).")" );