[BUG][FIX][TEST] Default Flap entries that don't exist in 3.6-5424-basic

Christian Eitner Christian.Eitner at cern.ch
Sun Oct 12 17:36:49 UTC 2003


He people,

I stumbled over this in the 3.6-5424-basic image, where there existed 
still entries for Scamper and Celeste in the default tools flap. After 
installing the FlapsRegistry from SM and selecting a different default 
font, the tools flap disappeared, because of reevaluation of the code, 
which failed at the missing keys in `Smalltalk at: ...'.
   To prevent this in future releases, and because I'm test-infected, I 
concocted a unit test that tests whether all default quads work. Please 
review, criticise and use.

   Christian
-------------- next part --------------
'From Squeak3.6 of ''6 October 2003'' [latest update: #5424] on 12 October 2003 at 7:25:40 pm'!
TestCase subclass: #FlapsTest
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Tests-Morphic-Flaps'!
!FlapsTest commentStamp: '<historical>' prior: 0!
A TestCase is a Command representing the future running of a test case. Create one with the class method #selector: aSymbol, passing the name of the method to be run when the test case runs.

When you discover a new fixture, subclass TestCase, declare instance variables for the objects in the fixture, override #setUp to initialize the variables, and possibly override# tearDown to deallocate any external resources allocated in #setUp.

When you are writing a test case method, send #assert: aBoolean when you want to check for an expected value. For example, you might say "self assert: socket isOpen" to test whether or not a socket is open at a point in a test.!


!FlapsTest methodsFor: 'initialize-release' stamp: 'cE 10/10/2003 19:08'!
setUp
	"I am the method in which your test is initialized. 
If you have ressources to build, put them here."! !

!FlapsTest methodsFor: 'initialize-release' stamp: 'cE 10/10/2003 19:08'!
tearDown
	"I am called whenever your test ends. 
I am the place where you release the ressources"! !

!FlapsTest methodsFor: 'initialize-release' stamp: 'cE 10/12/2003 19:24'!
testQuads
	"Defaults are defined in Flaps class>>defaultQuadsDefining...
	If you change something there, do the following afterwards:
	Flaps initializeFlapsQuads"

	| allQuads absentClasses absentSelectors |
	allQuads _ OrderedCollection new.
	absentClasses _ OrderedCollection new.
	Flaps registeredFlapsQuads valuesDo: [:each | allQuads addAll: each].
	allQuads do: [:each | | theObject |
		theObject _ each at: 1.
		Smalltalk
			at: theObject
			ifAbsent: [absentClasses add: each]].
	self
		assert: absentClasses size = 0
		description: 'There are absent classes: ' , absentClasses asString.
	absentSelectors _ OrderedCollection new.
	allQuads do: [:each | | theClass theSelector |
		theClass _ (Smalltalk at: (each at: 1)) class.
		theSelector _ each at: 2.
		(theClass canUnderstand: theSelector)
			ifFalse: [absentSelectors add: each]].
	self
		assert: absentSelectors size = 0
		description: 'There are absent selectors: ' , absentSelectors asString! !



More information about the Squeak-dev mailing list