Goods + TreeSet>>keyForValue: problems: Bug?

David Shaffer cdshaffer at acm.org
Sat Feb 19 16:08:55 UTC 2005


Attached is an SUnit test that summarizes the problem I'm having.  Edit 
the connect method to point to a spare GOODS server and run the tests.  
Debug the errors and you'll find that trying to send perform: #number to 
the TreeSetBugObject causes a DNU but clearly these object do understand 
that message.  Inspect the message target and manually set it 
number....works fine.  Inspect the message target (anObject) and 
manually send it perform: #number...works fine.  Strange.  I'm guessing 
that it is proxy related by my eyes are tired at this point.

Has anyone seen this kind of problem (TreeSet throws exception when 
testing inclusion?)?  Any ideas?

David

-------------- next part --------------
TestCase subclass: #TreeSetBugTest
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'TreeSetBug'!

!TreeSetBugTest methodsFor: 'tests' stamp: 'cds 2/19/2005 15:54'!
connect
	^KKDatabase onHost: 'localhost' port: 2004! !

!TreeSetBugTest methodsFor: 'tests' stamp: 'cds 2/19/2005 16:05'!
testBug
	| db obj holder |
	db := self connect.
	obj := TreeSetBugTestObject new.
	obj number: 1111.
	db root at: 'testObject' put: obj.
	holder := TreeSetBugTestHolder new.
	db root at: 'testHolder' put: holder.
	db commit.
	db logout.
	
	db := self connect.
	(db root at: 'testHolder') addEntry: (db root at: 'testObject').
	db commit.
	db logout.

	db := self connect.
	self assert: ((db root at: 'testHolder') includesEntry: (db root at: 'testObject')).
	db logout.! !

!TreeSetBugTest methodsFor: 'tests' stamp: 'cds 2/19/2005 16:05'!
testManualInit
	| db obj holder |
	db := self connect.
	obj := TreeSetBugTestObject new.
	obj number: 1111.
	db root at: 'testObject' put: obj.
	holder := TreeSetBugTestHolder new.
	holder manualInitialize.
	db root at: 'testHolder' put: holder.
	db commit.
	db logout.
	
	db := self connect.
	(db root at: 'testHolder') addEntry: (db root at: 'testObject').
	db commit.
	db logout.

	db := self connect.
	self assert: ((db root at: 'testHolder') includesEntry: (db root at: 'testObject')).
	db logout.! !


Object subclass: #TreeSetBugTestHolder
	instanceVariableNames: 'set'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'TreeSetBug'!

!TreeSetBugTestHolder methodsFor: 'accessing' stamp: 'cds 2/19/2005 15:57'!
addEntry: e
	self set add: e! !

!TreeSetBugTestHolder methodsFor: 'accessing' stamp: 'cds 2/19/2005 15:58'!
includesEntry: e
	^self set includes: e! !

!TreeSetBugTestHolder methodsFor: 'accessing' stamp: 'cds 2/19/2005 16:02'!
manualInitialize
	set := TreeSet sortBy: #number! !

!TreeSetBugTestHolder methodsFor: 'accessing' stamp: 'cds 2/19/2005 15:56'!
set
	^set ifNil: [set := (TreeSet sortBy: #number)]! !


Object subclass: #TreeSetBugTestObject
	instanceVariableNames: 'number'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'TreeSetBug'!

!TreeSetBugTestObject methodsFor: 'accessing' stamp: 'cds 2/19/2005 15:42'!
number
	^number! !

!TreeSetBugTestObject methodsFor: 'accessing' stamp: 'cds 2/19/2005 15:42'!
number: anObject
	number := anObject! !


More information about the Squeak-dev mailing list