On 08/12/2006, at 12:40 AM, Brett Payne-Rhodes wrote:

> Can anyone supply a simple example of an 'acceptable' use of  
> evaluate()?
>
> Cheers,
>
> Brett
> B)

I've written a very simple (one cfc) unit testing framework that some  
of our clients have been beta testing over the last few months.

One of the things that irked me about existing ColdFusion unit  
testing packages was that they had a profusion of assert() functions  
e.g. assertGreaterThan, assertLessThan etc - just like JUnit.  The  
only reason to have so many assert functions was so that the correct  
message could be printed when the assert failed.

My reckoning was that in a language with an evaluate() function we  
should be able to make a single assert that could print the entire  
expression that failed, and even better, print out the values of the  
individual elements of the expression being asserted, e.g. if assert 
("a(b) or c[d]") failed we could print out the values of "a(b) or c 
[d]", "a(b)", "c[d]", "b" and "d" by breaking up the original string  
and calling evaluate for each one.

So I use evaluate to make this assert function work.  It's only used  
in a testing context.  Otherwise (as anyone attending a CF course  
with me will attest) I avoid evaluate() and isDefined() wherever  
possible.

Cheers,
Robin

PS:  Mail me off list if you want to get a copy of the framework.   
I'm not going to generally release it until it's had a bit more testing.

______________

Robin Hilliard
Director - RocketBoots Pty Ltd
Consulting . Recruitment . Software Licensing . Training
http://www.rocketboots.com.au

For schedule/availability call Pamela Higgins:
w    +61 7 5451 0362
m    +61 419 677 151
f    +61 3 9923 6261
e    [EMAIL PROTECTED]

or Direct:
m    +61 418 414 341
e    [EMAIL PROTECTED]




--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to