Re: Testing Output and Functionality

Jed Lund <[email protected]>
Newsgroups gmane.comp.lang.perl.quality-assurance
Message-ID <CAM4-=+OJsGwjei=Fmn1-zhnwZHO1RykWYxTkLEn2SYwTce=K0A@mail.gmail.com>
Andy,

Thank you for the reply.

I did try Test::Output but I ran into a Smart::Comments incompatibility.
 This is a sort of corner case to the issue I described where I am trying
to print the Smart::Comments but capture the STDOUT output for testing.
 When I run the following;

use Test::Most;
use Test::Output;
use Smart::Comments '###';
stdout_is( sub{
    print "Hello World\n";
    ### Goodby World ...
}, "Hello World\n", 'Test Hello World' );
done_testing();

I get the following error;

Can't locate object method "TELL" via package "Test::Output::Tie" at
C:/Perl/site/lib/Smart/Comments.pm line 438.

While a warn or carp statement in the same place seems to work just fine
the Smart::Comments don't.  I kind of walked away at that point and started
looking somewhere else.  Should I just be more persistent to fix this issue
or is there another solution?

Best Regards,

Jed

On Mon, Apr 23, 2012 at 9:53 PM, Andy Lester <[email protected]> wrote:

>
> On Apr 23, 2012, at 11:35 PM, Jed Lund wrote:
>
> that element of code?  I have been hunting around CPAN for the right fit
> but so far I have only found STDERR/STDOUT tests or functionality tests not
> a way to test both results from the same method call.
>
>
> Sounds like you're looking for Test::Output.
>
> http://search.cpan.org/dist/Test-Output/
>
> xoxo,
> Andy
>
> --
> Andy Lester => [email protected] => www.petdance.com => AIM:petdance
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.