List Info

Thread: GNU Smalltalk Segfault with a Script I Wrote




GNU Smalltalk Segfault with a Script I Wrote
user name
2006-06-07 06:54:52
Shlomi Fish wrote:
> Hi!
>
> The attached script causes GNU Smalltalk (version
2.1.12, installed from 
> source) to crash. I'm using Mandriva 2006.
>   
You are not loading the SUnit package, so your MsfTest class
a) does not 
implement #run: and b) derives from nil.  It is normal to
have a crash 
if you call a method that is not understood by a class that
does not 
implement #doesNotUnderstand:.

I am currently thinking of a scripting syntax that will
catch mistakes 
like this.

It works if you add a

    PackageLoader fileInPackage: #SUnit!

line at the top, and change the last line to "t
run".

Paolo

----

TestCase subclass: #MsfTest
    instanceVariableNames: ''
    classVariableNames: ''
    poolDictionaries: ''
    category: 'SUnit-Tests'!
Object subclass: #SquaringFactors
    instanceVariableNames: 'numbers'
    classVariableNames: ''
    poolDictionaries: ''
    category: 'Program'!
!SquaringFactors methodsFor: 'initialization'!
from: myarr
    numbers := (OrderedCollection new: myarr).
!
!MsfTest methodsFor: 'testing'!
testMultiply
    |n m ret|
    n := (SquaringFactors new) from: #(2).
    m := (SquaringFactors new) from: #(3).
    ret := ((n multiplyBy: m) getArray).
    self assert: (ret at: 1) = 2.
    self assert: (ret at: 2) = 3.
!!
|t|
t := (MsfTest new).
t run: #testMultiply.

---
!




_______________________________________________
help-smalltalk mailing list
help-smalltalkgnu.org

http://lists.gnu.org/mailman/listinfo/help-smalltalk
GNU Smalltalk Segfault with a Script I Wrote
user name
2006-07-07 21:30:46
On Wednesday 07 June 2006 09:54, Paolo Bonzini wrote:
> Shlomi Fish wrote:
> > Hi!
> >
> > The attached script causes GNU Smalltalk (version
2.1.12, installed from
> > source) to crash. I'm using Mandriva 2006.
>
> You are not loading the SUnit package, so your MsfTest
class a) does not
> implement #run: and b) derives from nil.  It is normal
to have a crash
> if you call a method that is not understood by a class
that does not
> implement #doesNotUnderstand:.

I see. That's not good. gst should never crash.

>
> I am currently thinking of a scripting syntax that will
catch mistakes
> like this.
>
> It works if you add a
>
>     PackageLoader fileInPackage: #SUnit!
>
> line at the top, and change the last line to "t
run".
>

Thanks!

Regards,

	Shlomi Fish

------------------------------------------------------------
---------
Shlomi Fish      shlomifiglu.org.il
Homepage:        http://www.shlomifish.org/


95% of the programmers consider 95% of the code they did not
write, in the
bottom 5%.


_______________________________________________
help-smalltalk mailing list
help-smalltalkgnu.org

http://lists.gnu.org/mailman/listinfo/help-smalltalk
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )