Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

by ikegami (Patriarch)
on Jan 05, 2007 at 14:34 UTC ( [id://593115]=note: print w/replies, xml ) Need Help??


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

# Test::Simple or Test::More ok($var eq 'a' || $var eq 'b', "test name");

Update: map will help you avoid evaluating the expression twice. (Be careful about context.)
( Oops, added missing parens. Thanks shenme )

# Test::Simple or Test::More ok((map { $_ eq 'a' || $_ eq 'b' } $var), "test name");

Update: Or you could use a regexp.

# Test::More like($var, qr/^(?:a|b)\z/, "test name");

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://593115]
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-25 16:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found