Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ObjectWithPrintingRaisingHaltTest.testInspectingObjectWithPrintOnWithHaltOpenInspector #17815

Open
Ducasse opened this issue Feb 11, 2025 · 2 comments

Comments

@Ducasse
Copy link
Member

Ducasse commented Feb 11, 2025

Some of my changes probably broke

NewTools.Debugger.Tests.ObjectWithPrintingRaisingHaltTest.testInspectingObjectWithPrintOnWithHaltOpenInspector

And I need to investigate which one because I did not see them breaking before and they break in unrelated
case. So may be this is change in NewTools but the tests were green.

S

@Ducasse
Copy link
Member Author

Ducasse commented Feb 11, 2025

This is due to this change

StInspector >> windowTitle
	
	^ self model ifNotNil: [ :m | m printString ] ifNil: [ 'Inspector']

I start to get support bored to fix Spec legacy.
This is not nice that we just wait to clean and not do it regularly.
I'm not expert in Spec so obviously I can break things.

So I will just make the windowTitle returns a plain string because there is a logic problem
that the model may not be set at the time windowTitle is invoked and I tried to changed the order of the caller of windowTitle but it broke elsewhere (obviously).
So for now I will fix the test and it someone wants a cool inspector then he will have to do it.
I gave up.

@Ducasse
Copy link
Member Author

Ducasse commented Feb 11, 2025

I tried the following without success

testInspectingObjectWithPrintOnWithHaltOpenInspector
	"Make sure that inspecting an object with a broken printOn: does not produce an endless loop.
	"
	
	| openInspectors inspectedObject |
	(StInspectorPresenter allInstances reject: [:each | each window isNil]) 
		select: [ :e | e window isOpen ] 
		thenDo: [ :each | each window close ].

	inspectedObject := ObjectWithPrintingRaisingHalt new.
	"We are using halt in printOn: because halt is an exception (not an error).
	The problem was that protecting with onErrorDo: does not catch all exception in particular 
	Halt. And catching Exception in general is not possible else we could break on any printOn: method 
	in the system."
	
	inspectedObject inspect.

	openInspectors := (StInspectorPresenter allInstances reject: [:e | e window isNil]) select: [ :e | e window isOpen ].

	self assert: openInspectors size equals: 1.

	self
		assert: openInspectors first model inspectedObject
		equals: inspectedObject.

	StInspectorPresenter allInstances do: [ :each | each delete ].

and

StInspectorPresenter >> windowTitle
	"in the past the definition was 
	
	^ self model windowTitle but I could not make it during the massive cleaning of Spec.
	Sorry about it - SD"
	^ 'Inspector'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant