Skip to content

Commit 8647db7

Browse files
committed
Adding first test when moving cursor to the beginning of a statement, checking that the receiver and arguments are pushed on the stack and that nothing is executed
1 parent fa678e8 commit 8647db7

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

Sindarin-Tests/SindarinDebuggerTest.class.st

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Class {
55
'breakpointsBeforeTest',
66
'testObjectPoint'
77
],
8+
#classInstVars : [
9+
'helperMethod1'
10+
],
811
#category : #'Sindarin-Tests-Base'
912
}
1013

@@ -297,6 +300,34 @@ SindarinDebuggerTest >> testAssignmentVariableName [
297300
self assert: scdbg assignmentVariableName equals: #a
298301
]
299302

303+
{ #category : #'tests - skipping' }
304+
SindarinDebuggerTest >> testChangingPcKeepsSameStateAndPushesCorrectElementsOnStack [
305+
306+
| scdbg newPc newNode expectedStackTop |
307+
scdbg := SindarinDebugger debug: [ self helperMethod1 ].
308+
309+
scdbg
310+
step;
311+
stepOver.
312+
"pc of '3' asInteger"
313+
newNode := scdbg node.
314+
newPc := scdbg pc.
315+
expectedStackTop := scdbg topStack.
316+
scdbg
317+
stepOver;
318+
stepOver;
319+
stepOver.
320+
321+
self assert: (scdbg temporaryNamed: #a) equals: 5.
322+
323+
scdbg pc: newPc.
324+
325+
self assert: (scdbg temporaryNamed: #a) equals: 5.
326+
self assert: scdbg node equals: newNode.
327+
self assert: scdbg pc equals: newPc.
328+
self assert: scdbg topStack equals: expectedStackTop
329+
]
330+
300331
{ #category : #tests }
301332
SindarinDebuggerTest >> testContext [
302333
| scdbg |

Sindarin/SindarinDebugger.class.st

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,17 @@ SindarinDebugger >> pc [
402402
^ self context pc
403403
]
404404

405+
{ #category : #accessing }
406+
SindarinDebugger >> pc: anInteger [
407+
408+
self context pc: anInteger.
409+
[ self context stackPtr > self context numTemps ] whileTrue: [
410+
self context pop ].
411+
412+
self debugSession stepToFirstInterestingBytecodeIn:
413+
self debugSession interruptedProcess
414+
]
415+
405416
{ #category : #'stepping - auto' }
406417
SindarinDebugger >> proceed [
407418
"alias of #continue"

0 commit comments

Comments
 (0)