Skip to content

Implement debugger extensions like in StateSpecs-GTTools #34

@dionisiydk

Description

@dionisiydk

Sadly NewTools does not provide any hooks to extend debugger to support new kind of assertion failures. Only basic #assert: logic is supported with very primitive variable analysis:

Context>>findFailedAssertionContextInSenderChain

	^ (self findContextSuchThat: [ :ctx | 
		   (ctx hasTemporaryVariableNamed: #actual) and: [ 
			   ctx hasTemporaryVariableNamed: #expected ] ]) ifNil: [ 
		  StDebuggeAssertionFailureContextNotFound new signal ]

which is used from:

StDebuggerInspector>>updateLayoutForContexts: aContext isAssertionFailure: isTopContextFailingAssertion

	| assertionResult |
	isTopContextFailingAssertion ifFalse: [ 
		currentLayoutSelector = self defaultLayoutSelector ifTrue: [ ^ self ].
		self setDefaultLayout.
		^self ].
	currentLayoutSelector = self assertionLayoutSelector ifTrue: [ ^ self ].

	[ assertionResult := aContext findFailedAssertionResultsInSenderChain ]
		on: StDebuggeAssertionFailureContextNotFound
		do: [ self setDefaultLayout.
			^self ].		
	
	assertionFailure := StFailingAssertionInspector
		                    diffInspectorsFromActual: assertionResult actual
		                    expected: assertionResult expected
		                    application: self application.
	self setAssertionLayout

It should really lookup the exception and ask exception instance to setup the inspector extension. This requires contribution into NewTools project

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions