Recommended packages - BrowseUnit and"Debugger- stub methodcreation"

rrobbes rrobbes at etu.info.unicaen.fr
Tue Jul 22 17:12:44 UTC 2003


Hi all, 

Concerning BrowseUnit, I did it to incitate people
(me included :-) ) to use testing more easily and
regularly. Some people think the absence of tests
is one of the main problems hampering Squeak's
maintenability. So I think it would be a good idea
if every browser had a 'test' button by default...
I can even make it bigger if you want :-).
By the way I'll post a new version real soon
(maybe this evening). 

I think the 'debugger-stub method creation' is a
very useful package too. The only problem I had with
it is that it didn't let me choose the category of
the method when creating it. I did this change just today,
so I join the two methods if anyone (Adam?) is interested. 

   Romain. 

-------------- next part --------------
'From Squeak3.2 of 11 July 2002 [latest update: #4956] on 22 July 2003 at 7:07:42 pm'!

!Debugger methodsFor: 'private'!
askForCategoryOf: aClass toImplement: aSelector ifCancel: cancelBlock 
	| chosenClassIndex categories cat |
	categories := aClass organization categories , #('other ...').
	chosenClassIndex := PopUpMenu 
				withCaption: 'Define #' , aSelector , ' in which category?'
				chooseFrom: categories.
	chosenClassIndex = 0 ifTrue: [^cancelBlock value].

	cat := chosenClassIndex = categories size 
		ifTrue: [FillInTheBlank request: 'category name']
		ifFalse: [categories at: chosenClassIndex].
	cat = '' ifTrue: [^cancelBlock value].
	^ cat! !
-------------- next part --------------
'From Squeak3.2 of 11 July 2002 [latest update: #4956] on 22 July 2003 at 7:07:54 pm'!

!Debugger methodsFor: 'private'!
createMethod
	"Should only be called when this Debugger was created in response to a
	MessageNotUnderstood exception. Create a stub for the method that was
	missing and proceed into it."

	| msg chosenClass |
	msg := contextStackTop tempAt: 1.
	chosenClass := self 
				askForSuperclassOf: contextStackTop receiver class
				toImplement: msg selector
				ifCancel: [^self].
	chosenClass compile: msg createStubMethod
		classified: (self 
				askForCategoryOf: chosenClass
				toImplement: msg selector
				ifCancel: [^self]).
	self proceed! !


More information about the Squeak-dev mailing list