> On Jun 24, 2016, at 4:41 PM, Buddy Burden <barefootco...@gmail.com> wrote:
> 
>    is_true($val);
>    is_false($val);
> 
> Because with just `ok($val)` you can tell whether it's true or false, but, 
> when it inevitably fails, you really want to know what the bad value turned 
> out to be.


I have a bool_eq() so you can do this:

bool_eq( $want_foos, scalar @foos );

without having to do

if ( $want_foos ) {
    ok( scalar @foos );
}
else {
    is( scalar @foos, 0 );
}

We were also writing that as

is( !!$want_foos, !!(scalar @foos) );

which works, but obscures the meaning.

I don’t like the name bool_eq() (“booleans are equal”) but it was the best I 
could come up with.

--
Andy Lester => www.petdance.com

Reply via email to