help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Re: Magritte-Seaside and validation errors


From: Lukas Renggli
Subject: [Help-smalltalk] Re: Magritte-Seaside and validation errors
Date: Tue, 5 May 2009 22:15:46 +0200

I applied the patch to Squeak and it seems to work correctly. Also the
Pier tests pass, they further exercise the validation stuff.

I committed your changes as Magritte-Model-lr.345.

Cheers,
Lukas

On Tue, May 5, 2009 at 11:54 AM, Paolo Bonzini <address@hidden> wrote:
> Lukas Renggli wrote:
>> Cool test ;-)
>>
>> I get  #(false false false true false false false true) in Pharo
>> #10126 (that's an old version).
>>
>> The validation code is really ugly. It started out simple, but then
>> got incredibly complicated and fragile over time. I already fixed many
>> bugs that appeared in edge cases. Maybe we should instead just try to
>> fix Magritte instead?
>
> Cool test, but I was off track. :-)  The case that is hit by Magritte is
> the #ifFalse: one: the exception is created non-resumable, and made
> resumable and resignaled within the handler.  Now, if I understand
> correctly the ugliness is there to allow restarting to the test for
> another field, but at the same time avoiding an MARequiredError and an
> MAKindError for the same field.
>
> Thus, I took Nico's description and modified to use, instead of required
> MAStringDescriptions, a pair of required integer MANumberDescription.
> Then, just using this simpler code seems to work as I cannot get it to
> emit more than two errors:
>
> diff --git a/packages/magritte/magritte-model.st
> b/packages/magritte/magritte-model.st
> index 0f05d99..0c93469 100644
> --- a/packages/magritte/magritte-model.st
> +++ b/packages/magritte/magritte-model.st
> @@ -5507,13 +5507,9 @@ MAValidatorVisitor>>#visitDescription:
>        <category: 'visiting-descriptions'>
>        [self validate: self object using: aDescription] on:
> MAValidationError
>            do:
> -               [:err |
> -               err isResumable
> -                   ifTrue: [err pass]
> -                   ifFalse:
> -                       [err
> -                           beResumable;
> -                           signal]]
> +               [:err |
> +               err isResumable ifFalse: [err beResumable].
> +               err pass]
>     ]
>
>     visitTableDescription: aDescription [
>
> and all the unit tests still pass.  I'm a bit puzzled, maybe you were
> working around some issue in Squeak or maybe GNU Smalltalk has a bug?
>
> Paolo
>



-- 
Lukas Renggli
http://www.lukas-renggli.ch




reply via email to

[Prev in Thread] Current Thread [Next in Thread]