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 <alidran...@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

Reply via email to