On Dec 10, Michael Schwern wrote:
> I think I have a solution to the rigidity of is(). ie. something with
> the diagnostic output of is(), but the flexibility of ok().
>
> The principle idea being to replace code like:
>
> ok( $foo <= $bar ) || print "# $foo <= $bar\n";
>
> Provide an is() variant that takes an arbitrary op! My working title
> is is_op(), which I don't like very much.
>
> is_op( $foo, '<=', $bar );
> is_op( $foo, '==', $bar );
> is_op( $foo, 'eq', $bar ); # same as is()
> is_op( $foo, '&', $bar );
>
> which then just does:
>
> my $test = eval "$foo $op $bar";
>
> It all makes sense, so what I really need is a better name.
Why go to such trouble to have 20 different automagical comparators,
when you can do whatever you want with anonymous subs and/or eval in ok()?
Where's the real value? Frankly, I'm getting pretty confused by the
myriad testing options.
- Kurt