Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: 'either or' value unit test case in Test::Simple or Test::More

by shmem (Chancellor)
on Jan 05, 2007 at 14:48 UTC ( [id://593119]=note: print w/replies, xml ) Need Help??


in reply to 'either or' value unit test case in Test::Simple or Test::More

Use
ok( $var1 eq 'foo' || $var1 eq 'bar', 'either foo or bar');

i.e. make an expression that checks $var1 against both posibilities, and evaluates to either some true or some false value. Don't use

is( $var1 eq 'foo' ? 1 : $var1 eq 'bar'? 1 : undef, 1, 'either foo or +bar');

- that is syntax is explicitly discouraged in the docs. Thanks to ikegami for pointing that out via /msg.

--shmem

update: removed cluttered ternary op suggestion, incorporated ikegami's /msg.

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://593119]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-24 22:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found