On Mon, May 5, 2014 at 1:40 PM, Carlo <snoobabk@gmail.com> wrote:
Hi
Personally I think the main reason to use #should: is that debugging is easier as you can more easily restart the block in Debugger and replay the failing messages. i.e. think of the #should: as lazily running the code whereas #assert: as being eager because it evaluates the argument immediately. Often Iâll use the #assert:equals: or #assert:description so that I can more easily debug (by restarting the execution in the appropriate test method). I have previously modified the #assert: method to be polymorphic with a boolean or a block so I donât have to use #should: e.g.
assert: aBoolean aBoolean value ifFalse: [self logFailure: 'Assertion failed'. self defaultTestFailure signal: âAssertion failed'].
Apart from this I agree with all the comments on the doubts of using #should:. Converting #should: calls to #assert: calls is probably not worth the effort unless the #assert: is made polymorphic against a boolean or a block.
+1. But it's trivial to add value to assert: et al...
Cheers Carlo
On 01 May 2014, at 12:52 AM, Nicolas Cellier < nicolas.cellier.aka.nice@gmail.com> wrote:
Hi, I see many usage of #should: in SciSmalltalk tests that could simply be turned into #assert: or eventually #assert:equals: Why wanting to use a block? Other than #should:raise: and #shouldnt:raise:, I don't really see the point of #should: alone anyway... IMO should: should be deprecated, less is more. I'm possibly the author of several of these #should: sends, so don't take it personnally ;)
P.S. or is it easier to restart the block in the Debugger? I cross post to pharo-dev because it's a generic question, and there are a few #should: sends in Pharo-3.0 too.
-- best, Eliot