Testing for message excistance

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Testing for message excistance

Mispunt
Hi people,

I there a way to run a test to be sure that a message exists in a
class? I am working on some peace of code that just run a message of a
unknown class, so it is possible that this message doesn't exist and
fire an error.

Greetings,

Mispunt
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Testing for message excistance

Klaus D. Witzel
Sure, just browse the implementors of #canUnderstand:

/Klaus

On Tue, 01 May 2007 10:52:32 +0200, Mispunt wrote:

> Hi people,
>
> I there a way to run a test to be sure that a message exists in a
> class? I am working on some peace of code that just run a message of a
> unknown class, so it is possible that this message doesn't exist and
> fire an error.
>
> Greetings,
>
> Mispunt


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Testing for message excistance

NorbertHartl
In reply to this post by Mispunt
On Tue, 2007-05-01 at 10:52 +0200, Mispunt wrote:
> Hi people,
>
> I there a way to run a test to be sure that a message exists in a
> class? I am working on some peace of code that just run a message of a
> unknown class, so it is possible that this message doesn't exist and
> fire an error.
>
Yes, you can use respondsTo: aSymbol. So trying to find a method
print would lead to

ObjectOrClass respondsTo: #print

Norbert

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Testing for message excistance

Mispunt
Thanks, I will try it :)

Mispunt

On 5/1/07, Norbert Hartl <[hidden email]> wrote:

> On Tue, 2007-05-01 at 10:52 +0200, Mispunt wrote:
> > Hi people,
> >
> > I there a way to run a test to be sure that a message exists in a
> > class? I am working on some peace of code that just run a message of a
> > unknown class, so it is possible that this message doesn't exist and
> > fire an error.
> >
> Yes, you can use respondsTo: aSymbol. So trying to find a method
> print would lead to
>
> ObjectOrClass respondsTo: #print
>
> Norbert
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners