1use Test::More tests => 7; 2 3my $logger; 4{ 5 local $@ = undef; 6 eval { 7 no strict 'refs'; 8 $logger = &{${CLASS}."::new"}( 9 undef, LOG_UDP, 'localhost', 514, 10 LOG_LOCAL0, LOG_INFO, "mymachine", "logger" 11 ); 12 }; 13 ok(!$@, 'no exception thrown in ->new with missing class'); 14}; 15 16{ 17 local $@ = undef; 18 eval { 19 $CLASS->new( 20 LOG_UDP, undef, 514, 21 LOG_LOCAL0, LOG_INFO, "mymachine", "logger" 22 ); 23 }; 24 ok($@, 'exception thrown in ->new with missing host'); 25}; 26 27{ 28 local $@ = undef; 29 eval { 30 $CLASS->new( 31 LOG_UDP, 'localhost', 514, 32 LOG_LOCAL0, LOG_INFO, undef, "logger" 33 ); 34 }; 35 ok($@, 'exception thrown in ->new with missing sender'); 36}; 37 38{ 39 local $@ = undef; 40 eval { 41 $CLASS->new( 42 LOG_UDP, 'localhost', 514, 43 LOG_LOCAL0, LOG_INFO, "mymachine", undef 44 ); 45 }; 46 ok($@, 'exception thrown in ->new with missing name'); 47}; 48 49{ 50 local $@ = undef; 51 eval { 52 $logger->set_name(undef); 53 }; 54 ok($@, 'exception thrown in ->set_name'); 55}; 56 57{ 58 local $@ = undef; 59 eval { 60 $logger->set_receiver(undef); 61 }; 62 ok($@, 'exception thrown in ->set_receiver'); 63}; 64 65{ 66 local $@ = undef; 67 eval { 68 $logger->set_sender(undef); 69 }; 70 ok($@, 'exception thrown in ->set_sender'); 71}; 72 731; 74