| Issue 24: | change assert style back to original (message as last arg); provide means of turning on message-first syntax | |
| 1 person starred this issue and may be notified of changes. | Back to list |
originally, mxunit used message-optional syntax (assertEQuals(expected,actual,message).). Marc suggested it be changed to cfunit style because that was the junit style and because it might ease conversion from cfunit, as conversion from cfcunit was probably not going to happen because that's a pretty mature and robust framework compared with cfunit. however, Marc now believes he was wrong, so wrong in fact that his psyche is shattered and he now writes bug reports in the third person (he is crushed). So: 1) change all affected assertions back to the message-optional syntax 2) for assertEquals and assertTrue, provide a mechanism for enabling message-required, junit-style syntax
Nov 4, 2007
(No comment was entered for this change.)
Status:
Fixed
|
done. 1) added a new setTestStyle() function into assert. so in a testcase, one need just put setTestStyle("cfunit") in the constructor or setUp. one could even put setTestSTyle("cfunit") in a single method and then call setTestStyle("default") afterwards to reset it, if one were so inclined. that'd be dumb though. 2) I added a new normalizeArguments() method to Assert.cfc. it's braindead simple: if test style is cfunit (actually, if it's not "default"...so calling setTestStyle("bah") would trip it), then for assertEQuals() and assertTrue(), swap the args. Now, there is one problem here: if you use cfunit style syntax and use named arguments, then this will fail. the solution: just don't set the test style to cfunit! because this: assertEquals(message="blah",expected=1,actual=2) is the same as assertEquals(1,2,"blah") Again, this is merely a convenience, mostly to be used for helping people who have lots of tests to convert and who dont' have time to reorder their args