[Pharo-users] Failling Tests are green if BlockCannotReturn exception

Johan Fabry jfabry at dcc.uchile.cl
Mon Jan 11 18:31:50 EST 2016


Hi Abdelghani,

this is actually correct behavior: by putting [ ^1 ] , you are specifying that the method should return 1 when the block is executed. So the result of aBlock value is that the method returns 1. If you want that the result of evaluating the block is 1, you should just put [ 1 ]

Hope this helps,

> On Jan 11, 2016, at 20:26, abdelghani ALIDRA <alidrandco at yahoo.fr> wrote:
> 
> Hi,
> 
> I observed this unexpected behavior in test classes.
> In a test class define a method :
> 
> testBlock
>     |aBlock|
>     aBlock := [ ^1 ].
>     aBlock value.
>     self assert: false.
> 
> Althought the assertion is false at the end of the test, the test is green.
> Actually, It does not matter what you put after aBlock value, the test always succedes (I tried to put a self halt, it does not execute)
> I tried this both in Pharo 4 and 5 under Windows and MacOS.
> 
> Any ideas?
> 
> Cheers 
> Abdelghani
> 
> 



---> Save our in-boxes! http://emailcharter.org <---

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20160111/6fe1627c/attachment.html>


More information about the Pharo-users mailing list