in reply to Re: Checking parameters passed to a third party module during testing
in thread Checking parameters passed to a third party module during testing

That is in essence correct. In fact params is a compilation of parameters from various places. There is already validation code to check that the correct parameters are present. What I need the test system to do is ensure that the parameters have the correct values given known email text. That is, I want to check that the parsing process is generating the correct output email for a given input email.

What I think I need in the test script would look something like:

my $emailBody = '...'; my %generatedParams; # possibly some magic here to associate %generatedParams with %params +contents ok (parseEmail ($emailBody), 'Email parsed without error'); # possibly some magic here to get %params contents into %generatedPara +ms ok ($generatedParams{to} eq 'to@addr', 'To address generated correctly +'); ...

Yes, I mean %params is lexically scoped to the sub. (That's the C++ shining through.)

Update: Perhaps I should add that the sub containing the send code is not where the parsing is done,but it is the only place where all the pieces that comprise the email content come together. Various header information such as subject, to and from addresses and possibly other information headers are generated in the sub.


DWIM is Perl's answer to Gödel
  • Comment on Re^2: Checking parameters passed to a third party module during testing
  • Download Code