Re: Testing Output and Functionality

David Golden <[email protected]>
Newsgroups gmane.comp.lang.perl.quality-assurance
Message-ID <CAOeq1c8XVayhtNQpnfsUNkCi3wLA34cUYZUbDH2oHZp3MwpF_g@mail.gmail.com>
On Tue, Apr 24, 2012 at 12:35 AM, Jed Lund <[email protected]> wrote:
> I understand that this is a fairly basic question but I am stuck trying to
> find the right path forward.

It's not entirely basic, because you're testing an array of three
"outputs" for each functionality test instead of just one.

I'd probably use Capture::Tiny:

    use Capture::Tiny qw/capture/;

    my ($out, $err, $result) = capture { your_code_here };
    # then test $out, $err, $result however you want

If that's repetitive, stick it in a loop or write a function to
abstract testing the three results against your expectations.

-- David
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.