From 8b2a75347effe37e6e06c5453647f984c3865070 Mon Sep 17 00:00:00 2001 From: Evan Donahue Date: Fri, 2 Sep 2022 20:03:51 +0900 Subject: [PATCH 1/4] - Modified StDebuggerActionModel to use Exception>>defaultDescription as the debugger's window title rather than the context predicate. --- src/NewTools-Debugger/StDebuggerActionModel.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NewTools-Debugger/StDebuggerActionModel.class.st b/src/NewTools-Debugger/StDebuggerActionModel.class.st index e5d517591..4fdd46ea1 100644 --- a/src/NewTools-Debugger/StDebuggerActionModel.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModel.class.st @@ -351,7 +351,7 @@ StDebuggerActionModel >> stackOfSize: anInteger [ { #category : #context } StDebuggerActionModel >> statusStringForContext [ - ^ self contextPredicate printDescription + ^ self exception defaultDescription ] { #category : #'debug - stepping' } From 19f014f8d186e28121778be42ce8aa25f9316528 Mon Sep 17 00:00:00 2001 From: Evan Donahue Date: Wed, 7 Sep 2022 16:47:57 +0900 Subject: [PATCH 2/4] Added tests for the debugger's printDescription on several different Exception types --- .../StDebuggerContextPredicateTest.class.st | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/NewTools-Debugger-Tests/StDebuggerContextPredicateTest.class.st b/src/NewTools-Debugger-Tests/StDebuggerContextPredicateTest.class.st index e36a8ec4c..f8d2f1669 100644 --- a/src/NewTools-Debugger-Tests/StDebuggerContextPredicateTest.class.st +++ b/src/NewTools-Debugger-Tests/StDebuggerContextPredicateTest.class.st @@ -42,12 +42,28 @@ StDebuggerContextPredicateTest >> testIsSteppable [ self deny: predicate isSteppable ] +{ #category : #tests } +StDebuggerContextPredicateTest >> testPrintDNUDescription [ + self assert: (StDebuggerActionModel on: + ([ Object perform: #thisMessageIsNotUnderstood ] on: Exception do: + [ :e | StTestDebuggerProvider new sessionFor: nil exception: e ]) session) statusStringForContext + equals: 'Instance of Object class did not understand #thisMessageIsNotUnderstood'. +] + { #category : #tests } StDebuggerContextPredicateTest >> testPrintDescription [ self skip. self assert: predicate printDescription equals: '0' ] +{ #category : #tests } +StDebuggerContextPredicateTest >> testPrintExceptionDescription [ + self assert: (StDebuggerActionModel on: + ([ Exception signal ] on: Exception do: + [ :e | StTestDebuggerProvider new sessionFor: nil exception: e ]) session) statusStringForContext + equals: 'Exception'. +] + { #category : #tests } StDebuggerContextPredicateTest >> testPrintHaltDescription [ |haltContext| @@ -56,9 +72,33 @@ StDebuggerContextPredicateTest >> testPrintHaltDescription [ self assert: predicate printDescription equals: 'Halt in ', haltContext printString ] +{ #category : #tests } +StDebuggerContextPredicateTest >> testPrintHaltIfDescription [ + self assert: (StDebuggerActionModel on: + ([ Halt if: [ true ] ] on: Exception do: + [ :e | StTestDebuggerProvider new sessionFor: nil exception: e ]) session) statusStringForContext + equals: 'Halt in [ Halt if: [ true ] ] in StDebuggerContextPredicateTest>>testPrintHaltIfDescription'. +] + { #category : #tests } StDebuggerContextPredicateTest >> testPrintPostMortemDescription [ self skip. predicate postMortem: true. self assert: predicate printDescription equals: '[Post-mortem] 0' ] + +{ #category : #tests } +StDebuggerContextPredicateTest >> testPrintSignalInDescription [ + self assert: (StDebuggerActionModel on: + ([ Exception signalIn: thisContext ] on: Exception do: + [ :e | StTestDebuggerProvider new sessionFor: nil exception: e ]) session) statusStringForContext + equals: 'Exception'. +] + +{ #category : #tests } +StDebuggerContextPredicateTest >> testPrintTestFailureDescription [ + self assert: (StDebuggerActionModel on: + ([ TestFailure signal ] on: Exception do: + [ :e | StTestDebuggerProvider new sessionFor: nil exception: e ]) session) statusStringForContext + equals: 'TestFailure'. +] From a4e8527dee99d435c25f013fc4e270db68c69e6a Mon Sep 17 00:00:00 2001 From: Evan Donahue Date: Wed, 7 Sep 2022 20:44:13 +0900 Subject: [PATCH 3/4] - Made Halt print without context when signalled directly, to match existing behavior --- .../StDebuggerContextPredicateTest.class.st | 8 ++++++++ src/NewTools-Debugger/Halt.extension.st | 8 ++++++++ src/NewTools-Debugger/StDebuggerActionModel.class.st | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/NewTools-Debugger/Halt.extension.st diff --git a/src/NewTools-Debugger-Tests/StDebuggerContextPredicateTest.class.st b/src/NewTools-Debugger-Tests/StDebuggerContextPredicateTest.class.st index f8d2f1669..69ac5f1de 100644 --- a/src/NewTools-Debugger-Tests/StDebuggerContextPredicateTest.class.st +++ b/src/NewTools-Debugger-Tests/StDebuggerContextPredicateTest.class.st @@ -80,6 +80,14 @@ StDebuggerContextPredicateTest >> testPrintHaltIfDescription [ equals: 'Halt in [ Halt if: [ true ] ] in StDebuggerContextPredicateTest>>testPrintHaltIfDescription'. ] +{ #category : #tests } +StDebuggerContextPredicateTest >> testPrintHaltNowDescription [ + self assert: (StDebuggerActionModel on: + ([ Halt now ] on: Exception do: + [ :e | StTestDebuggerProvider new sessionFor: nil exception: e ]) session) statusStringForContext + equals: 'Halt'. +] + { #category : #tests } StDebuggerContextPredicateTest >> testPrintPostMortemDescription [ self skip. diff --git a/src/NewTools-Debugger/Halt.extension.st b/src/NewTools-Debugger/Halt.extension.st new file mode 100644 index 000000000..bdfbc82c3 --- /dev/null +++ b/src/NewTools-Debugger/Halt.extension.st @@ -0,0 +1,8 @@ +Extension { #name : #Halt } + +{ #category : #'*NewTools-Debugger' } +Halt >> description [ + (self signalContext receiver isKindOf: Exception) + & (self signalContext selector = #signal) ifTrue: [ ^ 'Halt' ]. + ^ 'Halt in ', self signalContext asString. +] diff --git a/src/NewTools-Debugger/StDebuggerActionModel.class.st b/src/NewTools-Debugger/StDebuggerActionModel.class.st index e5d517591..9145cdf7f 100644 --- a/src/NewTools-Debugger/StDebuggerActionModel.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModel.class.st @@ -351,7 +351,7 @@ StDebuggerActionModel >> stackOfSize: anInteger [ { #category : #context } StDebuggerActionModel >> statusStringForContext [ - ^ self contextPredicate printDescription + ^ self exception description ] { #category : #'debug - stepping' } From 2e6dd93fdf0595ace7c952a1b122a8fbc4dcc8a5 Mon Sep 17 00:00:00 2001 From: Evan Donahue Date: Wed, 7 Sep 2022 21:34:48 +0900 Subject: [PATCH 4/4] Reasserting reverted description string --- src/NewTools-Debugger/StDebuggerActionModel.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NewTools-Debugger/StDebuggerActionModel.class.st b/src/NewTools-Debugger/StDebuggerActionModel.class.st index 4fdd46ea1..9145cdf7f 100644 --- a/src/NewTools-Debugger/StDebuggerActionModel.class.st +++ b/src/NewTools-Debugger/StDebuggerActionModel.class.st @@ -351,7 +351,7 @@ StDebuggerActionModel >> stackOfSize: anInteger [ { #category : #context } StDebuggerActionModel >> statusStringForContext [ - ^ self exception defaultDescription + ^ self exception description ] { #category : #'debug - stepping' }