[Seaside-dev] WAExceptionHandlerTest>>testHandlesReturnBool

Michael Lucas-Smith mlucas-smith at cincom.com
Mon Jun 15 19:14:18 UTC 2009


Hi,

The test in question is this:

testHandlesReturnsBool
    self
        assertHandles: WATestError new
        returnsSatisfying: [ :result | result == true or: [ result == 
false ] ].
    self
        assertHandles: nil
        returnsSatisfying: [ :result | result == true or: [ result == 
false ] ]

assertHandles: anObject returnsSatisfying: aBlock
    | result instanceResult |
    result := self handlerClass handles: anObject.
    instanceResult := self createHandler handles: anObject.
    self assert: result = instanceResult.
    self assert: (aBlock value: result)

In VisualWorks, GenericException class>>handles: aSignalledException is 
implemented as:

    ^self accepts: aSignalledException creator

It's a method that you really "shouldn't get to" without 
aSignalledException being a real signallable object. The question was 
raised by another engineer here as to why we would want to make this 
method do a type-check if it's never practically put in the situation 
created by the test case.

I tend to agree with his assessment, which is why I'm raising it here.. 
I'd like to remove the second clause since it's not an execution 
scenario Seaside would ever have to care about.

Is that okay?

Michael

Julian Fitzell wrote:
> Off the top of my head I'm guessing this is one of the tests based on
> the literal interpretation of the ANSI standard, which suggests that
> any objects that implement the correct protocol can be used for
> exception handling. It's a little hard to imagine that nil would
> implement the protocol though and your description of the assertion
> isn't specific enough for me to be sure.
>
> And for some reason, I just noticed none of my Squeak VMs are starting
> this afternoon (error "-10810") so I'll need to look into that before
> I can even look at the code. :)
>
> If you can post the test case I may have a better idea.
>
> Julian
>
> On 6/12/09, Michael Lucas-Smith <mlucas-smith at cincom.com> wrote:
>   
>> Hi All,
>>
>> There's a test called #testHandlesReturnBool which is a little odd. It
>> asserts that you can handle 'nil' as an exception. This is ... well.. odd.
>>
>> Does anyone know what this test was trying to achieve?
>>
>> Michae
>> _______________________________________________
>> seaside-dev mailing list
>> seaside-dev at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>>
>>     
> _______________________________________________
> seaside-dev mailing list
> seaside-dev at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>
>   



More information about the seaside-dev mailing list