Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 52 additions & 33 deletions DebuggingSpy-Tests/DSSpyInstrumenterTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -564,12 +564,13 @@ DSSpyInstrumenterTest >> testInstrumentProceed [

| debugger command record |
debugger := StDummyDebuggerPresenter new.
debugger open.
command := StProceedCommand forContext: debugger.
command execute.

self assert: self registry size equals: 1.
self assert: self registry size equals: 2.

record := self registry first.
record := self registry second.
self assert: record class identicalTo: DSProceedRecord
]

Expand All @@ -578,12 +579,13 @@ DSSpyInstrumenterTest >> testInstrumentRestart [

| debugger command record |
debugger := StDummyDebuggerPresenter new.
debugger open.
command := StRestartCommand forContext: debugger.
command execute.

self assert: self registry size equals: 1.
self assert: self registry size equals: 2.

record := self registry first.
record := self registry second.
self assert: record class identicalTo: DSRestartRecord
]

Expand All @@ -592,12 +594,13 @@ DSSpyInstrumenterTest >> testInstrumentReturn [

| debugger command record |
debugger := StDummyDebuggerPresenter new.
debugger open.
command := StReturnValueCommand forContext: debugger.
command execute.

self assert: self registry size equals: 1.
self assert: self registry size equals: 2.

record := self registry first.
record := self registry second.
self assert: record class identicalTo: DSReturnValue
]

Expand Down Expand Up @@ -705,12 +708,13 @@ DSSpyInstrumenterTest >> testInstrumentRunTo [

| debugger command record |
debugger := StDummyDebuggerPresenter new.
debugger open.
command := StRunToSelectionCommand forContext: debugger.
command execute.

self assert: self registry size equals: 1.
self assert: self registry size equals: 2.

record := self registry first.
record := self registry second.
self assert: record class identicalTo: DSRunToSelectionRecord
]

Expand All @@ -724,7 +728,7 @@ DSSpyInstrumenterTest >> testInstrumentSendersAction [
self assert: self registry size equals: 2.

record := self registry first.
self assert: record class identicalTo: DSImplementorsRecord.
self assert: record class identicalTo: DSSendersRecord.
self assert: record windowId equals: nil
]

Expand All @@ -743,7 +747,7 @@ DSSpyInstrumenterTest >> testInstrumentSpCodeBrowse [
record := self registry first.

self assert: record class identicalTo: DSBrowseRecord.
self assert: record windowId equals: codePresenter window identityHash
self assert: record windowId equals: codePresenter window window identityHash
]

{ #category : 'tests - interactions' }
Expand Down Expand Up @@ -785,19 +789,27 @@ DSSpyInstrumenterTest >> testInstrumentSpCodeDoIt [
{ #category : 'tests - interactions' }
DSSpyInstrumenterTest >> testInstrumentSpCodeDoItAndGoForInspector [

| presenter record |
| presenter record model context |
presenter := StObjectContextPresenter basicNew.
presenter setModelBeforeInitialization: self stObjectContextModelMock.
[ presenter intializePresentersWithEvaluator ]
on: Error
do: [ "we just pass layout initialization errors as we do not care" ].

model := StInspectorModel on: StInspectorMockObject new.
context := StInspectionContext fromPragma: (StInspectorMockObject >> #inspectionMock1:) pragmas first.
context inspectedObject: model inspectedObject.
presenter setModelBeforeInitialization: (StObjectContextModel new
inspection: model;
inspectedObject: model inspectedObject;
context: context;
yourself).
presenter application: StPharoApplication new.
presenter initialize.
presenter open.

presenter evaluator text: '4+2'.
presenter evaluator selectionInterval: (1 to: 3).

presenter doEvaluateAndGo.

self assert: self registry size equals: 1.
record := self registry first.
self assert: self registry size equals: 2.
record := self registry second.

self assert: record class identicalTo: DSDoItAndGoRecord.
self assert: record selectedString equals: '4+2'
Expand All @@ -808,17 +820,21 @@ DSSpyInstrumenterTest >> testInstrumentSpCodeDoItAndGoForPlayground [

| presenter record |
presenter := StPlaygroundPagePresenter basicNew.
presenter forceDisableLoading.
presenter setModelBeforeInitialization: (StPlaygroundPage new
timeToWait: 5 milliSeconds;
baseDirectory: FileSystem memory;
yourself).
presenter application: StPharoApplication new.
presenter initializePresenters.
presenter setModelBeforeInitialization: DSFakeTextEditor new.
presenter forceDisableLoading.
presenter initialize.
presenter open.

presenter text text: '4+2'.
presenter text selectionInterval: (1 to: 3).

presenter doEvaluateAndGo.

self assert: self registry size equals: 1.
record := self registry first.
self assert: self registry size equals: 2.
record := self registry second.

self assert: record class identicalTo: DSDoItAndGoRecord.
self assert: record selectedString equals: '4+2'
Expand All @@ -839,7 +855,7 @@ DSSpyInstrumenterTest >> testInstrumentSpCodeImplementors [

record := self registry first.
self assert: record class identicalTo: DSImplementorsRecord.
self assert: record windowId equals: codePresenter window identityHash.
self assert: record windowId equals: codePresenter window window identityHash.

record := self registry second.
self assert: record class identicalTo: DSWindowOpenedRecord
Expand Down Expand Up @@ -894,7 +910,7 @@ DSSpyInstrumenterTest >> testInstrumentSpCodeSenders [

record := self registry first.
self assert: record class identicalTo: DSSendersRecord.
self assert: record windowId equals: codePresenter window identityHash.
self assert: record windowId equals: codePresenter window window identityHash.

record := self registry second.
self assert: record class identicalTo: DSWindowOpenedRecord
Expand All @@ -905,12 +921,13 @@ DSSpyInstrumenterTest >> testInstrumentStepInto [

| debugger command record |
debugger := StDummyDebuggerPresenter new.
debugger open.
command := StStepIntoCommand forContext: debugger.
command execute.

self assert: self registry size equals: 1.
self assert: self registry size equals: 2.

record := self registry first.
record := self registry second.
self assert: record class identicalTo: DSStepIntoRecord
]

Expand All @@ -919,12 +936,13 @@ DSSpyInstrumenterTest >> testInstrumentStepOver [

| debugger command record |
debugger := StDummyDebuggerPresenter new.
debugger open.
command := StStepOverCommand forContext: debugger.
command execute.

self assert: self registry size equals: 1.
self assert: self registry size equals: 2.

record := self registry first.
record := self registry second.
self assert: record class identicalTo: DSStepOverRecord
]

Expand All @@ -933,12 +951,13 @@ DSSpyInstrumenterTest >> testInstrumentStepThrough [

| debugger command record |
debugger := StDummyDebuggerPresenter new.
debugger open.
command := StStepThroughCommand forContext: debugger.
command execute.

self assert: self registry size equals: 1.
self assert: self registry size equals: 2.

record := self registry first.
record := self registry second.
self assert: record class identicalTo: DSStepThroughRecord
]

Expand Down Expand Up @@ -1021,7 +1040,7 @@ DSSpyInstrumenterTest >> testLoggingInteractionsWithNoSourceCode [
DSDoItRecord.
DSPrintItRecord } do: [ :recordClass |
| record |
record := recordClass new record: 'test'.
record := recordClass new recordSelectedString: 'test'.
self assert: record selectedString equals: DSSpy recordSourceCodeDisabledErrorMessage ]
]

Expand Down
6 changes: 6 additions & 0 deletions DebuggingSpy/DSAbstractDebuggerActionRecord.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ Class {
#package : 'DebuggingSpy',
#tag : 'Records'
}

{ #category : 'actions api' }
DSAbstractDebuggerActionRecord >> record: aWindow [

self windowId: aWindow context window window identityHash
]
13 changes: 9 additions & 4 deletions DebuggingSpy/DSCodeActionRecord.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ Class {
{ #category : 'actions api' }
DSCodeActionRecord >> record: anEditor [

selectedString := DSSpy recordSourceCode
ifTrue: [ anEditor recordSelectedString ]
ifFalse: [ DSSpy recordSourceCodeDisabledErrorMessage ].
self recordSelectedString: anEditor recordSelectedString.
self windowId: anEditor recordWindow identityHash
]

super record: anEditor
{ #category : 'accessing' }
DSCodeActionRecord >> recordSelectedString: aString [

selectedString := DSSpy recordSourceCode
ifTrue: [ aString ]
ifFalse: [ DSSpy recordSourceCodeDisabledErrorMessage ]
]

{ #category : 'accessing' }
Expand Down
6 changes: 3 additions & 3 deletions DebuggingSpy/DSHaltHitRecord.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ DSHaltHitRecord >> once: aBoolean [

{ #category : 'actions api' }
DSHaltHitRecord >> record: anRBProgramNodeAndASelector [

once := false.
conditional := false.
super record: anRBProgramNodeAndASelector first.
selector := anRBProgramNodeAndASelector second.
selector = #once: ifTrue:[once := true].
selector = #haltIf: ifTrue:[conditional := true]

selector = #once: ifTrue: [ once := true ].
selector = #haltIf: ifTrue: [ conditional := true ]
]

{ #category : 'accessing' }
Expand Down
10 changes: 6 additions & 4 deletions DebuggingSpy/DSSpyInstrumenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,10 @@ DSSpyInstrumenter >> instrumentImplementorsActions [
"Instruments actions to show implementors of a method"

ClyShowMessageImplementorCommand link: DSImplementorsRecord link toAST: (ClyShowMessageImplementorCommand >> #execute) ast.
ClyTextEditor link: DSImplementorsRecord link toAST: (ClyTextEditor>>#implementorsOf:) ast.
ClyTextEditor link: DSImplementorsRecord link toAST: (ClyTextEditor >> #implementorsOf:) ast.
RubSmalltalkEditor link: DSImplementorsRecord link toAST: (RubSmalltalkEditor >> #implementorsOf:) ast.
SpBrowseImplementorsCommand link: DSImplementorsRecord link toAST: (SpBrowseImplementorsCommand >> #execute) ast
SpBrowseImplementorsCommand link: DSImplementorsRecord link toAST: (SpBrowseImplementorsCommand >> #execute) ast.
StImplementorsCommand link: DSImplementorsRecord link toAST: (StImplementorsCommand >> #execute) ast
]

{ #category : 'interactions' }
Expand Down Expand Up @@ -164,8 +165,9 @@ DSSpyInstrumenter >> instrumentSendersActions [

ClyShowMessageSenderCommand link: DSSendersRecord link toAST: (ClyShowMessageSenderCommand >> #execute) ast.
ClyTextEditor link: DSSendersRecord link toAST: (ClyTextEditor>>#sendersOf:) ast.
RubSmalltalkEditor link: DSImplementorsRecord link toAST: (RubSmalltalkEditor >> #sendersOf:) ast.
SpBrowseSendersCommand link: DSSendersRecord link toAST: (SpBrowseSendersCommand >> #execute) ast
RubSmalltalkEditor link: DSSendersRecord link toAST: (RubSmalltalkEditor >> #sendersOf:) ast.
SpBrowseSendersCommand link: DSSendersRecord link toAST: (SpBrowseSendersCommand >> #execute) ast.
StMessageSendersCommand link: DSSendersRecord link toAST: (StMessageSendersCommand >> #execute) ast
]

{ #category : 'debugger' }
Expand Down
2 changes: 1 addition & 1 deletion DebuggingSpy/SpToolCommand.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ Extension { #name : 'SpToolCommand' }
{ #category : '*DebuggingSpy' }
SpToolCommand >> recordWindow [

^ self context window
^ self context window window
]
7 changes: 7 additions & 0 deletions DebuggingSpy/StCommand.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : 'StCommand' }

{ #category : '*DebuggingSpy' }
StCommand >> recordWindow [

^ self context window window
]
7 changes: 7 additions & 0 deletions DebuggingSpy/StPresenter.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : 'StPresenter' }

{ #category : '*DebuggingSpy' }
StPresenter >> recordWindow [

^ self window window
]