develooper Front page | perl.perl6.users | Postings from October 2018

Re: Appropriate last words

Thread Previous
From:
Richard Hainsworth
Date:
October 22, 2018 14:33
Subject:
Re: Appropriate last words
Message ID:
4d9a7c46-4fa3-b6ba-964f-dcaf47c2cce1@gmail.com
<snip>
>   And that is the way to test it.
>
>     but then I cant work out how to get the message. I've been looking at
>     Zoffix's Test::Output, but not
>
>
>   Incomplete sentence there.  I guess it doesn't work for you?  Tell 
> us how you tried to use it, what you were expecting, and what happened 
> instead.
My bad. I was distracted half-way through.

The Test::Trap seems to be what I am looking for.
>
>   I guess I should look into porting Test::Trap to Perl6 ... in Perl5, 
> I'd just write the test like so:
>
>   trap { some_code() };
>   $trap->stderr_like(qr/some pattern/, 'stderr from some_code matches 
> some pattern');
>   $trap->did_exit('some_code exited');
>   # or if you care about the exact exit code:
>   $trap->exit_is(1, 'exit code 1 from some_code');
>
>    ... or thereabouts. I'm stuck on my phone and no perl at the 
> moment  ...
>
>
> Eirik


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About