thanos1983 has asked for the wisdom of the Perl Monks concerning the following question:
Hello fellow Monks,
Recently I released the Unicode::Peek thanks to everyone suggestions and ideas. While I was still adding some test cases that every now and then that come to my mind I got this error today Can't locate Test/Exception.pm in....
I know what the error stands for, but I am impressed that this module is not installed on CPANPLUS. I have added some test cases on my module that I want to capture croak error message from Carp module.
When I searched online most articles that I found they suggest that this is the module that someone should use on die test cases. Sample of successful compiling test case code (test.t):
#########################
use utf8;
use strict;
use warnings;
use Test::More tests => 3;
BEGIN { use_ok('Test::Exception') };
BEGIN { use_ok('Unicode::Peek', qw( :all )) };
#########################
throws_ok { hexDumperOutput('Test', '這是一個測試') }
qr/Unknown encoding format 'Test'/,
'Check encoding formats hexDumperOutput';
__END__
$ perl t/test.t
1..3
ok 1 - use Test::Exception;
ok 2 - use Unicode::Peek;
ok 3 - Check encoding formats hexDumperOutput
I assumed that by default this is a core module and it would be installed by default but I guess I was wrong.
Does any one know any other way of testing croak? I have tried a few other suggestions e.g. Testing error handling that calls "die" but so far not successfully.
Thanks in advance for everyone time and effort reading and replying to my question.
|
|---|