From 7c9925b91c523f0b2c2078fefe177f2a7cc86016 Mon Sep 17 00:00:00 2001 From: adri09070 <97704417+adri09070@users.noreply.github.com> Date: Tue, 13 Jun 2023 14:28:28 +0200 Subject: [PATCH 1/7] compiling missing method when loading master or Pharo12 in P12, because it deletes a method from the entire system, while it should ONLY delete it from Sindarin --- .../BaselineOfSindarin.class.st | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/BaselineOfSindarin/BaselineOfSindarin.class.st b/src/BaselineOfSindarin/BaselineOfSindarin.class.st index aaea820..733ba0c 100644 --- a/src/BaselineOfSindarin/BaselineOfSindarin.class.st +++ b/src/BaselineOfSindarin/BaselineOfSindarin.class.st @@ -6,17 +6,31 @@ Class { { #category : #baselines } BaselineOfSindarin >> baseline: spec [ + - + spec for: #common do: [ + spec postLoadDoIt: #postloadWithLoader:withPackageSpec:. + + spec + package: 'Sindarin'; + package: 'Sindarin-Tests'; + package: 'Sindarin-Experiments' ]. + spec - for: #common - do: [ - spec - package: 'Sindarin'; - package: 'Sindarin-Tests'; - package: 'Sindarin-Experiments' ]. - - spec - group: 'default' with: #( 'Sindarin' 'Sindarin-Tests'); - group: 'experiments' with: #('default' 'Sindarin-Experiments') + group: 'default' with: #( 'Sindarin' 'Sindarin-Tests' ); + group: 'experiments' with: #( 'default' 'Sindarin-Experiments' ) +] + +{ #category : #baselines } +BaselineOfSindarin >> postloadWithLoader: loader withPackageSpec: spec [ + + InstructionStream compiledMethodAt: #willJumpIfFalse ifAbsent: [ + Smalltalk compiler + source: 'willJumpIfFalse + "Answer whether the next bytecode is a jump-if-false." + + ^ self method encoderClass isBranchIfFalseAt: pc in: self method'; + class: InstructionStream; + compile; + install ] ] From 9851661ce41665fdae22084652460274efc42b8f Mon Sep 17 00:00:00 2001 From: adri09070 <97704417+adri09070@users.noreply.github.com> Date: Tue, 13 Jun 2023 14:55:26 +0200 Subject: [PATCH 2/7] fixing return skip so that every return can be skipped except the last one --- src/Sindarin/SindarinDebugger.class.st | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Sindarin/SindarinDebugger.class.st b/src/Sindarin/SindarinDebugger.class.st index cddd0a4..ec10f5c 100644 --- a/src/Sindarin/SindarinDebugger.class.st +++ b/src/Sindarin/SindarinDebugger.class.st @@ -424,8 +424,20 @@ SindarinDebugger >> skipMessageNodeWith: replacementValue [ { #category : #'stepping - skip' } SindarinDebugger >> skipReturnNode [ - self flag: 'We should be able to skip a return node as long as it''s not the last one in the method'. - ^ SindarinSkippingReturnWarning signal: 'Cannot skip a return node' + | node allReturnNodes | + node := self node. + + "We collect the list of nodes associated to a return bytecode, via the IR" + allReturnNodes := self method ir children flatCollect: [ :irSequence | + irSequence sequence + select: [ :irInstruction | + irInstruction isReturn ] + thenCollect: [ :irInstruction | + irInstruction sourceNode ] ]. + "If this is the last node of the method that is mapped to a return bytecode, we can't skip it and we stop there." + node == allReturnNodes last ifTrue: [ + ^ SindarinSkippingReturnWarning signal: + 'Cannot skip the last return in the method' ] ] { #category : #'stepping - skip' } From 21cd65b31c37113d73a11bcb485e100ee488535b Mon Sep 17 00:00:00 2001 From: adri09070 <97704417+adri09070@users.noreply.github.com> Date: Tue, 13 Jun 2023 15:00:51 +0200 Subject: [PATCH 3/7] adding tests for skipping returns + making skipReturnNode step to first interesting bytecode after having skipped the return node --- .../SindarinDebuggerTest.class.st | 58 +++++++++++++++++++ src/Sindarin/SindarinDebugger.class.st | 6 +- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/src/Sindarin-Tests/SindarinDebuggerTest.class.st b/src/Sindarin-Tests/SindarinDebuggerTest.class.st index 4dd99e5..d89c2aa 100644 --- a/src/Sindarin-Tests/SindarinDebuggerTest.class.st +++ b/src/Sindarin-Tests/SindarinDebuggerTest.class.st @@ -145,6 +145,18 @@ SindarinDebuggerTest >> methodWithSeveralInstructionsInBlock [ ^ 42 ] +{ #category : #helpers } +SindarinDebuggerTest >> methodWithSeveralReturns [ + "There is only one explicit return but there is also an implicit return after `a := 3`. In that sense, there are several returns in this method" + + | a | + a := true. + a + ifFalse: [ ^ a := 1 ] + ifTrue: [ a := 2 ]. + a := 3 +] + { #category : #helpers } SindarinDebuggerTest >> methodWithTwoAssignments [ @@ -1311,6 +1323,52 @@ SindarinDebuggerTest >> testSkipBlockNode [ self assert: scdbg topStack equals: 43 ] +{ #category : #tests } +SindarinDebuggerTest >> testSkipCanSkipReturnIfItIsNotTheLastReturn [ + + | scdbg | + scdbg := SindarinDebugger debug: [ self methodWithSeveralReturns ]. + + "we step until we arrive on the node `^ a := 1` in `SindarinDebuggerTest>>#methodWithSeveralReturns`." + scdbg + step; + skip; + skip; + step. + + self assert: scdbg node isReturn. + self assert: scdbg topStack equals: 1. + + "We skip the return node" + self shouldnt: [ scdbg skip ] raise: SindarinSkippingReturnWarning. + + "We should be on the `a := 2` node" + self assert: scdbg node isAssignment. + self assert: scdbg node value value equals: 2 +] + +{ #category : #tests } +SindarinDebuggerTest >> testSkipCannotSkipReturnIfItIsTheLastReturn [ + + | scdbg nodeWithImplicitReturn | + scdbg := SindarinDebugger debug: [ self methodWithSeveralReturns ]. + + "we step until we arrive on the method node in `SindarinDebuggerTest>>#methodWithSeveralReturns`, which is mapped to the implicit return bycode." + scdbg step. + nodeWithImplicitReturn := scdbg methodNode. + 3 timesRepeat: [ scdbg step ]. + + self assert: scdbg node identicalTo: nodeWithImplicitReturn. + self assert: scdbg instructionStream willReturn. + + "We skip the return node" + self should: [ scdbg skip ] raise: SindarinSkippingReturnWarning. + + "We should still be on the method node" + self assert: scdbg node identicalTo: nodeWithImplicitReturn. + self assert: scdbg instructionStream willReturn +] + { #category : #tests } SindarinDebuggerTest >> testSkipDoesNotSkipReturn [ diff --git a/src/Sindarin/SindarinDebugger.class.st b/src/Sindarin/SindarinDebugger.class.st index ec10f5c..afa6a32 100644 --- a/src/Sindarin/SindarinDebugger.class.st +++ b/src/Sindarin/SindarinDebugger.class.st @@ -437,7 +437,11 @@ SindarinDebugger >> skipReturnNode [ "If this is the last node of the method that is mapped to a return bytecode, we can't skip it and we stop there." node == allReturnNodes last ifTrue: [ ^ SindarinSkippingReturnWarning signal: - 'Cannot skip the last return in the method' ] + 'Cannot skip the last return in the method' ]. + + self skipPcToNextBytecode. + self debugSession stepToFirstInterestingBytecodeWithJumpIn: + self debugSession interruptedProcess ] { #category : #'stepping - skip' } From f579ce479524d464db1a8865fc4b59722d853446 Mon Sep 17 00:00:00 2001 From: adri09070 <97704417+adri09070@users.noreply.github.com> Date: Wed, 14 Jun 2023 09:43:53 +0200 Subject: [PATCH 4/7] making #pc: push the temp vector if the temp vector bytecode is on the method node + test --- .../SindarinDebuggerTest.class.st | 47 +++++++++++++++++++ src/Sindarin/SindarinDebugger.class.st | 11 +++-- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/src/Sindarin-Tests/SindarinDebuggerTest.class.st b/src/Sindarin-Tests/SindarinDebuggerTest.class.st index 4dd99e5..66b695a 100644 --- a/src/Sindarin-Tests/SindarinDebuggerTest.class.st +++ b/src/Sindarin-Tests/SindarinDebuggerTest.class.st @@ -124,6 +124,16 @@ SindarinDebuggerTest >> methodWithNotEvaluatedBlock [ ^ a * 42 ] +{ #category : #helpers } +SindarinDebuggerTest >> methodWithNotEvaluatedBlockWhoseCreationIsFirstBytecodeInFirstStatement [ + + | a block | + block := [ a := a + 1 ]. + a := 1. + a := a + 2. + ^ a * 42 +] + { #category : #helpers } SindarinDebuggerTest >> methodWithOneAssignment [ @@ -919,6 +929,43 @@ SindarinDebuggerTest >> testMoveToNodeWhenFromNonInlinedEmbeddedBlockToNodeThatI self assert: sdbg topStack equals: 2 ] +{ #category : #helpers } +SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInBlockThatCreatesContextAndBlockCreationIsFirstBytecodeInFirstStatement [ + + | aimedBlock sdbg aimedNode | + sdbg := SindarinDebugger debug: [ + self + methodWithNotEvaluatedBlockWhoseCreationIsFirstBytecodeInFirstStatement ]. + "We step until the `a * 42` node" + sdbg step. + 6 timesRepeat: [ sdbg stepOver ]. + + self assert: sdbg method identicalTo: self class + >> + #methodWithNotEvaluatedBlockWhoseCreationIsFirstBytecodeInFirstStatement. + self assert: (sdbg readVariableNamed: #a) identicalTo: 3. + + "We jump to the node `a + 1` inside the block" + aimedBlock := sdbg methodNode statements first value. + aimedNode := aimedBlock body statements first value. + sdbg moveToNode: aimedNode. + + "We are in the block context" + self assert: sdbg method ast identicalTo: aimedBlock. + "The block context can also read #a" + self assert: (sdbg readVariableNamed: #a) identicalTo: 3. + + "We step the entire block" + 3 timesRepeat: [ sdbg stepOver ]. + + "We are back in the context method" + self assert: sdbg method identicalTo: self class + >> + #methodWithNotEvaluatedBlockWhoseCreationIsFirstBytecodeInFirstStatement. + "We can still read #a in the method context" + self assert: (sdbg readVariableNamed: #a) identicalTo: 4 +] + { #category : #tests } SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInBlockThatCreatesContextAndBlockHasBeenCreated [ diff --git a/src/Sindarin/SindarinDebugger.class.st b/src/Sindarin/SindarinDebugger.class.st index cddd0a4..5ef0baa 100644 --- a/src/Sindarin/SindarinDebugger.class.st +++ b/src/Sindarin/SindarinDebugger.class.st @@ -243,13 +243,12 @@ SindarinDebugger >> nextExecutedNodeAfter: aNode [ { #category : #'API - changes' } SindarinDebugger >> pc: anInteger [ - "Allows to move to the first PC associated to the node to which anInteger is associated. anInteger must be a valid pc in the suspended context" | nextNode methodNode firstPCOfStatementNode | "If aimedPC is outside the context PCs range, then an error is signaled" - (anInteger < self method initialPC or: [ - anInteger > self method endPC ]) ifTrue: [ + (anInteger < self method initialPC or: [ + anInteger > self method endPC ]) ifTrue: [ ^ NotValidPcError signal ]. methodNode := self methodNode. nextNode := methodNode sourceNodeForPC: anInteger. @@ -261,6 +260,12 @@ SindarinDebugger >> pc: anInteger [ methodNode statements first. self cleanStack ]. self context pc: firstPCOfStatementNode. + + "If the first pc of the first statement is mapped to a block creation. That means that it needs the associated temp vector on top of the stack. The bytecode that pushes this vector on the stack precedes the block creation. So, here, this bytecode is mapped to the method node and has been skipped. Thus, we go back to the previous bytecode to execute it." + self instructionStream willCreateBlock ifTrue: [ + self context pc: self instructionStream previousPc. + self stepBytecode ]. + self debugSession stepToFirstInterestingBytecodeIn: self debugSession interruptedProcess. self skipUpToNode: nextNode From b413095750761450932a20dfc34e2b043258506f Mon Sep 17 00:00:00 2001 From: adri09070 <97704417+adri09070@users.noreply.github.com> Date: Fri, 1 Sep 2023 10:45:42 +0200 Subject: [PATCH 5/7] adding quick doc for jump to caret --- README.md | 18 ++++- doc/README.md | 18 ++++- doc/jump-to-caret.md | 167 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 201 insertions(+), 2 deletions(-) create mode 100644 doc/jump-to-caret.md diff --git a/README.md b/README.md index 29c50d9..2e51871 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,26 @@ dbg currentNode inspect. ... ``` +### Jump to caret VS skip command usage + +[See here](./doc/jump-to-caret.md) + ## Install + +### For Pharo 12 or + + +```Smalltalk +Metacello new + baseline: 'Sindarin'; + repository: 'github://pharo-spec/ScriptableDebugger'; + load. +``` + +### For Pharo 11 or - + ```Smalltalk Metacello new baseline: 'Sindarin'; - repository: 'github://dupriezt/ScriptableDebugger'; + repository: 'github://pharo-spec/ScriptableDebugger:Pharo-11'; load. ``` diff --git a/doc/README.md b/doc/README.md index 29c50d9..bdca505 100644 --- a/doc/README.md +++ b/doc/README.md @@ -16,10 +16,26 @@ dbg currentNode inspect. ... ``` +### Jump to caret VS skip command usage + +[See here](./jump-to-caret.md) + ## Install + +### For Pharo 12 or + + +```Smalltalk +Metacello new + baseline: 'Sindarin'; + repository: 'github://pharo-spec/ScriptableDebugger'; + load. +``` + +### For Pharo 11 or - + ```Smalltalk Metacello new baseline: 'Sindarin'; - repository: 'github://dupriezt/ScriptableDebugger'; + repository: 'github://pharo-spec/ScriptableDebugger:Pharo-11'; load. ``` diff --git a/doc/jump-to-caret.md b/doc/jump-to-caret.md new file mode 100644 index 0000000..7ddabcc --- /dev/null +++ b/doc/jump-to-caret.md @@ -0,0 +1,167 @@ +# JumpToCaret command + +This PR introduces a new JumpToCaret command that allows to move the program execution to the first PC associated to the specific AST node associated to where the caret has been placed. + +The command itself can be accessed via the advanced steps menu in the debugger toolbar: + +![image](https://user-images.githubusercontent.com/97704417/199499862-1f6286e9-1641-4673-89ec-0eb710bfea99.png) + +You should put your caret somewhere in the code before using this command, otherwise it will go back to the beginning of the method (even before the creation of temporaries). + +## Tutorial: What you can do with JumpToCaret + +### Everything that you can do with `SkipUpTo`: + +* Jump to caret forward to skip instructions to caret: + +In the screnshot below, `a` is equal to 1 and we jump to caret that is on the `a * 42` message node: + +![image](https://user-images.githubusercontent.com/97704417/199500697-33ec53cd-82e4-4fd3-aba0-2bc4698dc2e2.png) + +After jumping to caret, the next instruction that will be executed is the `a * 42` message node. You can also see that `a` is still equal to 1 as the assignment `a := a +2` has been skipped: + +![image](https://user-images.githubusercontent.com/97704417/199501275-aa064c79-25e4-43cf-a711-e3587beb0bad.png) + +* Jump to caret inside an inlined block (such as an ifTrue: or ifFalse: block) + +In the screenshot below, we put our caret inside the ifFalse: block: + +![image](https://user-images.githubusercontent.com/97704417/199502028-cb430763-59ed-4a17-a0bf-5a0c81569a62.png) + +After jumping to caret, we have entered the ifFalse: block and `a` is still nil, as the assignment `a := true` has been skipped. + +![image](https://user-images.githubusercontent.com/97704417/199502784-3acfaea0-95d2-46cd-b9aa-3ff70b1a9795.png) + +Then, you can enter the ifTrue: block if you want too: + +![image](https://user-images.githubusercontent.com/97704417/199502718-ad73304a-0115-49cc-9fb7-f1c159401c3b.png) + +![image](https://user-images.githubusercontent.com/97704417/199502875-7a47809f-92a5-43e9-9619-532bb6fff8b6.png) + +### You can also do other things that you cannot do with the SkipUpTo command: + +* JumpToCaret allows to go backward in the execution, while keeping the state of the program before jumping to caret. + +In this screenshot below, `a` is equal to 1, and we want to jump to caret on the message node `a + 2`: + +![image](https://user-images.githubusercontent.com/97704417/199504092-b114a516-e84f-42ea-b484-523f15475353.png) + +After jumping to caret, as you'd expect, the next instruction that will be executed is the message node: + +![image](https://user-images.githubusercontent.com/97704417/199504431-8ac8c26d-3520-4bb8-8343-c3024d6e832e.png) + +If you step twice, the message node `a + 2` and the assignment node `a := a +2` will be executed and `a` will be equal to 3: + +![image](https://user-images.githubusercontent.com/97704417/199505116-2deb0072-bd31-48d4-b7c5-e48fa3aa05f5.png) + +Now, what you can do with jumpToCaret and that you can't do with skipUpTo is jumping back to caret on the `a + 2` message node: + +![image](https://user-images.githubusercontent.com/97704417/199505241-d2cdc77d-13c9-4cb7-a8b1-aa3f7d5c7ab2.png) + +Then you can step twice again to execute the message node and the assignment node and `a` will be equal to 5: + +![image](https://user-images.githubusercontent.com/97704417/199505392-c87caaee-961c-40a5-ad1e-761cd9abb691.png) + +So, jumpToCaret is very useful if you want to see and debug what happens when a piece of code is executed several times. + +* JumpToCaret allows to jump inside a non-inlined (embedded or not) block (= that needs to be evalued and that creates their own context) + +In the screenshot below, `a` is equal to 1 and the next instruction that will be executed is the message node `a + 2`, whose receiver value 1 has already been pushed on the stack: + +![image](https://user-images.githubusercontent.com/97704417/199506520-7d69c628-2978-4f1c-bf97-7dac8dacc1c8.png) + +If we move to caret, inside the block, on the `a + 1` message node, then, as you'd expect, the next instruction that will be executed is the `a + 1` message node inside the block. However, as the block is not inlined, a context has been created for it and it has become the suspended context: + +![image](https://user-images.githubusercontent.com/97704417/199507339-ca9dc453-3cd5-45c0-beea-528cf0f896b3.png) + +Now, stepping twice will execute the `a + 1` message node and the ` a := a + 1` assignment node AND the block return. So the result of the block is put on the stack. After exiting the block context via these steps, you go back in the parent context right after the block creation: + +![image](https://user-images.githubusercontent.com/97704417/199509395-288f55fb-6055-4825-9269-6f10760f300b.png) + +You should be really careful when exiting a block via steps if you have entered this block via the jumpToCaret command, as the result of the block is pushed on the stack and becomes the argument of the next bytecode that should be executed (as its real argument had already been pushed on the stack before jumping to caret). If this is not intended, you should reexecute the jumpToCaret command to jump to where you are in order to clean the stack: + +![image](https://user-images.githubusercontent.com/97704417/199509590-0998176f-997e-4453-bc84-014837dee0fb.png) + +After jumping to caret, the stack has been cleaned (stackTop is not 2 that was the result of the block anymore). + +Note that you can enter embedded blocks. In this case, as many contexts as there are embedding levels are created: + +![image](https://user-images.githubusercontent.com/97704417/199510368-c246ef15-36dc-46c4-8e14-6a837861d81e.png) + +![image](https://user-images.githubusercontent.com/97704417/199510514-9e4971b8-4448-4af8-a68a-962a7b560d55.png) + +So, jumpToCaret is useful to see and debug what happens when a block that is never evaluated is actually evaluated. + +* jumpToCaret allows to jump outside a block (whether it's embedded or not) + +In the screenshot below, we have entered an embedded block thanks to the `jumpToCaret` command and the next instruction that is going to be executed is the `a + 1` message node: + +![image](https://user-images.githubusercontent.com/97704417/199511658-c69d2961-9175-4f7f-b216-7e8b244e6019.png) + +After jumping to caret outside the block, on the `a + 2` message node, then as this message node is in the home context method node, all contexts above the suspended context are discarded and, as you'd expect, the next instruction that is going to be executed is the `a + 2` message node: + +![image](https://user-images.githubusercontent.com/97704417/199512309-00714bb2-a7be-4ff9-b623-d5463c1e9cc1.png) + +Note that if the aimed node was outside the suspended context block node, but inside another context (let's call it C) block node whose context is between the suspended context and its home context, then only the contexts above the context C are discarded: + +![image](https://user-images.githubusercontent.com/97704417/199513271-05f6efd4-2459-4e96-80a7-7502e6a4c32c.png) + +![image](https://user-images.githubusercontent.com/97704417/199513315-c39578e9-157f-4a71-b43c-13d4cd1ebec4.png) + +So, jumpToCaret is useful to exit non-inlined blocks, in order to go back to a context between its sender context and its home context, without executing the rest of the block closure. + +### What you cannot do with jumpToCaret: + +* As skipUpTo, jumpToCaret does not allow to skip return nodes **yet**. + +Except when the return node is in a non-inlined block (non-local return) as jumping outside non-inlined block discards the entire context, it is not possible to jump over a return bytecode. + +This is a problem inherited from skipUpTo, as we didn't allow skipUpTo to skip return bytecodes because a context needs to return something. + +Of course, you will never see any code after a return node that is not in a block because Pharo does not allow to write unreachable code (except in DoIts and unreachable code after ifTrue: ifFalse: blocks that contain returns , but we don't take these cases into account, as anyway this code is never executed normally). + +However, this can become a problem in the case below: + +![image](https://user-images.githubusercontent.com/97704417/199517675-f0bcab0b-bae3-4c4e-b52b-e5c7e468d2ae.png) + +Here, we want to jump to caret on the `a := 3` assignment node, after an ifFalse: ifTrue: message. However, jumping to caret does not stop on the assignment but it stops on the return node in the `ifTrue:` block because it has a return node and this block is inlined in the method bytecode, before the aimed node: + +![image](https://user-images.githubusercontent.com/97704417/199518649-00390554-e134-407a-8080-33a989c355d3.png) + +The bug also appears with skipUpTo and this is a problem as the assignment `a := 3` is reachable so this should be possible to jump to it. + +Here, it is possible to go there without executing anything by: +° jump to caret at the end of the ifFalse: block : + +![image](https://user-images.githubusercontent.com/97704417/199519522-642f3987-3ff1-4818-94af-72147d433fc4.png) + +° skipping the last instruction of the ifFalse: block that doesn't return: + +![image](https://user-images.githubusercontent.com/97704417/199519947-a93d1a15-f92f-4164-83c4-d99295749406.png) + +![image](https://user-images.githubusercontent.com/97704417/199520501-2f753095-f580-488b-aa4c-15309b5e39a9.png) + +° stepping over (that keeps the program state as it is. Here, it just jumps after the ifTrue: block as it considers that the ifFalse: block has been executed): + +![image](https://user-images.githubusercontent.com/97704417/199520790-cbe41b96-7fc9-4f23-95d5-97471806f269.png) + +However this is really tedious and we have to think about a way to make it work. Furthermore, there are some cases for which no easy workaround exists. In the screenshot below, we want to enter the inlined ifTrue: block in the ifTrue:ifFalse: message: + +![image](https://user-images.githubusercontent.com/97704417/199521325-3ed96839-e11b-4765-aed6-402aa6d24cf5.png) + +After jumping to caret, we stop on the return node in the inlined ifFalse: block because it is before the inlined ifTrue: block: + +![image](https://user-images.githubusercontent.com/97704417/199521790-7b5d72d0-0778-4035-ae07-5bf064efa970.png) + +* It is not possible to jump to caret within a context that is not the top context yet + +## Implementation notes: +- + * We get the AST node associated to the caret and get the first PC in the method associated to the AST node. If it is nil, then we check if the node is actually in the method (or block) node. If it is not in the method node and if it is not in the home context method node, we signal an error. If it is not in the method node but if it is in the home context method node, that means we want to exit a block and we discard the contexts above to exit the block and jump to the aimed node in this context. + * If the aimedPC for the aimed node is nil and if the aimed node is a recursive child of the method node (this is the case for variable nodes in assignments for example), then we get the first node that is executed after the aimed node and that has a PC associated to it and then we move to the first PC associated to this node instead. If this node is a block node, then this means that we want to enter a block. Then after having jumped to the block creation, we step the block creation bytecode to get the block closure and create a new context for it. We set this new block context as the suspended context in the process and the debug session and we recursively `moveToNode:` to jump to the aimed node in the new context. +- In the implementation, I work with AST node identity, because, for instance if we want to jump to an RBLiteralValueNode 1, we want to jump to this specific node and not any other RBLiteralValueNode 1 that could be anywhere else in the method node. + +## Known related issues: +- #55 (minor issue, will be fixed shortly) +- return node in inlined block issue (annoying issue that prevents to use this command at full power but does not induce any crash), will be fixed shortly +- It is not possible to jump to caret within a context that is not the top context \ No newline at end of file From 25f45c27c6d1db024a82d5682afd6fcfdda0e766 Mon Sep 17 00:00:00 2001 From: Inao0 <37711386+Inao0@users.noreply.github> Date: Fri, 29 Mar 2024 11:19:31 +0100 Subject: [PATCH 6/7] Fix #87. testIsAboutToInstantiateClass is using #basicNew:header: instead of #newMethod:header: --- .../SindarinDebugSessionMock.class.st | 34 +-- .../SindarinDebugSessionTest.class.st | 16 +- .../SindarinDebuggerTest.class.st | 220 +++++++++--------- src/Sindarin-Tests/package.st | 2 +- 4 files changed, 139 insertions(+), 133 deletions(-) diff --git a/src/Sindarin-Tests/SindarinDebugSessionMock.class.st b/src/Sindarin-Tests/SindarinDebugSessionMock.class.st index 2d5a92a..c24dbda 100644 --- a/src/Sindarin-Tests/SindarinDebugSessionMock.class.st +++ b/src/Sindarin-Tests/SindarinDebugSessionMock.class.st @@ -2,80 +2,82 @@ I mock sindarin debug sessions to control it finely during tests " Class { - #name : #SindarinDebugSessionMock, - #superclass : #Object, + #name : 'SindarinDebugSessionMock', + #superclass : 'Object', #instVars : [ 'isMessage', 'selector', 'receiver' ], - #category : #'Sindarin-Tests-Mocks' + #category : 'Sindarin-Tests-Mocks', + #package : 'Sindarin-Tests', + #tag : 'Mocks' } -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSessionMock >> context [ ^self ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSessionMock >> debugSession [ ^self ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSessionMock >> interruptedContext [ ^self ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSessionMock >> isMessage [ ^isMessage ifNil:[false] ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSessionMock >> isMessage: anObject [ isMessage := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSessionMock >> method [ ^self ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSessionMock >> pc [ ^self ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSessionMock >> receiver [ ^receiver ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSessionMock >> receiver: anObject [ receiver := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSessionMock >> selector [ ^selector ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSessionMock >> selector: anObject [ selector := anObject ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSessionMock >> sourceNodeExecuted [ ^self ] -{ #category : #accessing } +{ #category : 'accessing' } SindarinDebugSessionMock >> sourceNodeForPC: pc [ ^self ] diff --git a/src/Sindarin-Tests/SindarinDebugSessionTest.class.st b/src/Sindarin-Tests/SindarinDebugSessionTest.class.st index 1e7e05c..b3d6381 100644 --- a/src/Sindarin-Tests/SindarinDebugSessionTest.class.st +++ b/src/Sindarin-Tests/SindarinDebugSessionTest.class.st @@ -1,14 +1,16 @@ Class { - #name : #SindarinDebugSessionTest, - #superclass : #TestCase, + #name : 'SindarinDebugSessionTest', + #superclass : 'TestCase', #instVars : [ 'debugSession', 'sindarinSession' ], - #category : #'Sindarin-Tests-Base' + #category : 'Sindarin-Tests-Base', + #package : 'Sindarin-Tests', + #tag : 'Base' } -{ #category : #running } +{ #category : 'running' } SindarinDebugSessionTest >> setUp [ "Hooks that subclasses may override to define the fixture of test." @@ -17,13 +19,13 @@ SindarinDebugSessionTest >> setUp [ sindarinSession := debugSession asSindarinDebugSession ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebugSessionTest >> testDebugSessionAsSindarinDebugSession [ self assert: sindarinSession debugSession identicalTo: debugSession ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebugSessionTest >> testSindarinSessionAsSindarinDebugSession [ self @@ -31,7 +33,7 @@ SindarinDebugSessionTest >> testSindarinSessionAsSindarinDebugSession [ identicalTo: sindarinSession ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebugSessionTest >> testSindarinSessionInstantiation [ | sessionName process | diff --git a/src/Sindarin-Tests/SindarinDebuggerTest.class.st b/src/Sindarin-Tests/SindarinDebuggerTest.class.st index a90d944..9922a36 100644 --- a/src/Sindarin-Tests/SindarinDebuggerTest.class.st +++ b/src/Sindarin-Tests/SindarinDebuggerTest.class.st @@ -1,13 +1,15 @@ Class { - #name : #SindarinDebuggerTest, - #superclass : #TestCase, + #name : 'SindarinDebuggerTest', + #superclass : 'TestCase', #instVars : [ 'testObjectPoint' ], - #category : #'Sindarin-Tests-Base' + #category : 'Sindarin-Tests-Base', + #package : 'Sindarin-Tests', + #tag : 'Base' } -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodNonLocalReturn [ | block | block := [ ^ 42 ]. @@ -15,7 +17,7 @@ SindarinDebuggerTest >> methodNonLocalReturn [ ^ 43 ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodReturn: bool with: anObject [ | a | @@ -24,7 +26,7 @@ SindarinDebuggerTest >> methodReturn: bool with: anObject [ ^ anObject ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodReturnWithException [ | a | @@ -33,7 +35,7 @@ SindarinDebuggerTest >> methodReturnWithException [ ^ a + 1 ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodReturnWithHalt [ @@ -43,7 +45,7 @@ SindarinDebuggerTest >> methodReturnWithHalt [ ^ a + 1 ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodWithBlockWithNoReturn [ | block a | @@ -52,20 +54,20 @@ SindarinDebuggerTest >> methodWithBlockWithNoReturn [ ^ 43 ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodWithContextPassedToBlockParameter: storeContextBlock [ storeContextBlock value: thisContext ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodWithDoubleAssignment [ | b a | a := b := 1 ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodWithEmbeddedBlock [ | a | @@ -75,7 +77,7 @@ SindarinDebuggerTest >> methodWithEmbeddedBlock [ ^ a * 42 ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodWithEvaluatedBlock [ | a b block | @@ -86,7 +88,7 @@ SindarinDebuggerTest >> methodWithEvaluatedBlock [ ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodWithIfTrueBlock [ | a | @@ -95,7 +97,7 @@ SindarinDebuggerTest >> methodWithIfTrueBlock [ a := 4 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> methodWithIfTrueIfFalse [ | a | @@ -106,7 +108,7 @@ SindarinDebuggerTest >> methodWithIfTrueIfFalse [ a := 3 ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodWithImplicitReturn [ testObjectPoint sign. @@ -114,7 +116,7 @@ SindarinDebuggerTest >> methodWithImplicitReturn [ Point new ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodWithNotEvaluatedBlock [ | a | @@ -124,7 +126,7 @@ SindarinDebuggerTest >> methodWithNotEvaluatedBlock [ ^ a * 42 ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodWithNotEvaluatedBlockWhoseCreationIsFirstBytecodeInFirstStatement [ | a block | @@ -134,7 +136,7 @@ SindarinDebuggerTest >> methodWithNotEvaluatedBlockWhoseCreationIsFirstBytecodeI ^ a * 42 ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodWithOneAssignment [ | a | @@ -142,7 +144,7 @@ SindarinDebuggerTest >> methodWithOneAssignment [ ^ Point x: 5 y: '3' asInteger ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodWithSeveralInstructionsInBlock [ | a b block | @@ -155,7 +157,7 @@ SindarinDebuggerTest >> methodWithSeveralInstructionsInBlock [ ^ 42 ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodWithSeveralReturns [ "There is only one explicit return but there is also an implicit return after `a := 3`. In that sense, there are several returns in this method" @@ -167,7 +169,7 @@ SindarinDebuggerTest >> methodWithSeveralReturns [ a := 3 ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> methodWithTwoAssignments [ | a | @@ -176,12 +178,12 @@ SindarinDebuggerTest >> methodWithTwoAssignments [ ^ Point x: 5 y: '3' asInteger ] -{ #category : #running } +{ #category : 'running' } SindarinDebuggerTest >> runCaseManaged [ ^ self runCase ] -{ #category : #running } +{ #category : 'running' } SindarinDebuggerTest >> setUp [ "Hooks that subclasses may override to define the fixture of test." @@ -190,13 +192,13 @@ SindarinDebuggerTest >> setUp [ testObjectPoint := Point x: 1 y: 2 ] -{ #category : #running } +{ #category : 'running' } SindarinDebuggerTest >> tearDown [ super tearDown ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testArguments [ | p scdbg | p := Point new. @@ -208,7 +210,7 @@ SindarinDebuggerTest >> testArguments [ ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testAssignmentValue [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -216,7 +218,7 @@ SindarinDebuggerTest >> testAssignmentValue [ self assert: scdbg assignmentValue equals: 5 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testAssignmentVariableName [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -224,7 +226,7 @@ SindarinDebuggerTest >> testAssignmentVariableName [ self assert: scdbg assignmentVariableName equals: #a ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testCanStillExecuteWhenAimedNodePcIsAfterInAnyContext [ | sdbg aimedNodeInContext aimedNodeOutsideContext | @@ -252,7 +254,7 @@ SindarinDebuggerTest >> testCanStillExecuteWhenAimedNodePcIsAfterInAnyContext [ self assert: (sdbg canStillExecute: aimedNodeOutsideContext) ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testCanStillExecuteWhenAimedNodePcIsBeforeInAnyContext [ | sdbg aimedNodeInContext aimedNodeOutsideContext | @@ -280,7 +282,7 @@ SindarinDebuggerTest >> testCanStillExecuteWhenAimedNodePcIsBeforeInAnyContext [ self deny: (sdbg canStillExecute: aimedNodeOutsideContext) ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testChangingPcAssociatedToMethodOrSequenceNodeKeepsStackAsItIs [ | scdbg newPc newNode expectedStackTop | @@ -301,7 +303,7 @@ SindarinDebuggerTest >> testChangingPcAssociatedToMethodOrSequenceNodeKeepsStack self assert: scdbg topStack equals: expectedStackTop ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testChangingPcInTheMiddleOfStatementSkipsTheBeginningOfStatement [ | scdbg newPc newNode expectedStackTop | @@ -336,7 +338,7 @@ SindarinDebuggerTest >> testChangingPcInTheMiddleOfStatementSkipsTheBeginningOfS self assert: scdbg topStack equals: '3' "topStack is nil because the message send asInteger to the receiver '3' has been skipped" ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testChangingPcKeepsSameStateAndPushesCorrectElementsOnStack [ | scdbg newPc newNode expectedStackTop | @@ -363,7 +365,7 @@ SindarinDebuggerTest >> testChangingPcKeepsSameStateAndPushesCorrectElementsOnSt self assert: scdbg topStack equals: expectedStackTop ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testChangingPcRaisesErrorWhenPcIsGreaterThanEndPC [ | oldPC sdbg | @@ -387,7 +389,7 @@ SindarinDebuggerTest >> testChangingPcRaisesErrorWhenPcIsGreaterThanEndPC [ assert: sdbg pc equals: oldPC ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testChangingPcRaisesErrorWhenPcIsLowerThanInitialPC [ | scdbg | @@ -410,7 +412,7 @@ SindarinDebuggerTest >> testChangingPcRaisesErrorWhenPcIsLowerThanInitialPC [ self should: [ scdbg pc: scdbg method initialPC - 1 ] raise: NotValidPcError. ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testChangingPcToNonExistingBytecodeOffsetGoesToPreviousPcWithExistingBytecodeOffset [ | scdbg newPc newNode | @@ -430,7 +432,7 @@ SindarinDebuggerTest >> testChangingPcToNonExistingBytecodeOffsetGoesToPreviousP self assert: scdbg pc equals: newPc - 1. ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testContext [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -439,7 +441,7 @@ SindarinDebuggerTest >> testContext [ self assert: scdbg context equals: scdbg debugSession interruptedContext ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testContinue [ | scdbg | @@ -454,7 +456,7 @@ SindarinDebuggerTest >> testContinue [ self assert: scdbg isExecutionFinished ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testContinueEncoutersAnException [ | scdbg | @@ -469,7 +471,7 @@ SindarinDebuggerTest >> testContinueEncoutersAnException [ self assert: scdbg isAboutToSignalException ] -{ #category : #'tests - execution predicates' } +{ #category : 'tests - execution predicates' } SindarinDebuggerTest >> testIsAboutToInstantiateClass [ |debugger session| @@ -504,12 +506,12 @@ SindarinDebuggerTest >> testIsAboutToInstantiateClass [ self assert: debugger isAboutToInstantiateClass. session receiver: CompiledCode. - session selector: #newMethod:header:. "Primitive 79" + session selector: #basicNew:header: . "Primitive 79" self assert: debugger isAboutToInstantiateClass ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testIsAssignment [ | scdbg | @@ -521,7 +523,7 @@ SindarinDebuggerTest >> testIsAssignment [ self deny: scdbg isAssignment ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testIsExecutionFinished [ | scdbg | @@ -535,7 +537,7 @@ SindarinDebuggerTest >> testIsExecutionFinished [ self assert: scdbg currentProcess isTerminated ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testIsMessageSend [ | scdbg | @@ -547,7 +549,7 @@ SindarinDebuggerTest >> testIsMessageSend [ self assert: scdbg isMessageSend ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMessage [ | scdbg | @@ -555,7 +557,7 @@ SindarinDebuggerTest >> testMessage [ self assert: (scdbg message: #methodWithOneAssignment) ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMessageArguments [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -566,7 +568,7 @@ SindarinDebuggerTest >> testMessageArguments [ self assert: (scdbg messageArguments at: 2) equals: 3 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMessageReceiver [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -575,7 +577,7 @@ SindarinDebuggerTest >> testMessageReceiver [ self assert: scdbg messageReceiver equals: '3' ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMessageSelector [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -586,7 +588,7 @@ SindarinDebuggerTest >> testMessageSelector [ self assert: scdbg messageSelector equals: #x:y: ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMessageTo [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithImplicitReturn ]. @@ -604,7 +606,7 @@ SindarinDebuggerTest >> testMessageTo [ self deny: (scdbg message: #extent: to: Point new) ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMessageToInstanceOf [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithImplicitReturn ]. @@ -615,7 +617,7 @@ SindarinDebuggerTest >> testMessageToInstanceOf [ self deny: (scdbg message: #bogus toInstanceOf: Point) ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMethod [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -626,7 +628,7 @@ SindarinDebuggerTest >> testMethod [ self assert: scdbg method equals: String>>#asInteger ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMoveToNodeInTheMiddleOfStatementSkipsTheBeginningOfStatement [ | scdbg newPc newNode expectedStackTop | @@ -661,7 +663,7 @@ SindarinDebuggerTest >> testMoveToNodeInTheMiddleOfStatementSkipsTheBeginningOfS self assert: scdbg topStack equals: '3' "topStack is nil because the message send asInteger to the receiver '3' has been skipped" ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMoveToNodeKeepsSameStateAndPushesCorrectElementsOnStack [ | scdbg newPc newNode expectedStackTop | @@ -688,7 +690,7 @@ SindarinDebuggerTest >> testMoveToNodeKeepsSameStateAndPushesCorrectElementsOnSt self assert: scdbg topStack equals: expectedStackTop ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMoveToNodeKeepsStackWhenAimedNodeIsMethodNode [ | scdbg newPc newNode expectedStackTop | @@ -710,7 +712,7 @@ SindarinDebuggerTest >> testMoveToNodeKeepsStackWhenAimedNodeIsMethodNode [ self assert: scdbg topStack equals: expectedStackTop ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMoveToNodeKeepsStackWhenAimedNodeIsMethodNodeThatDoesNotHaveAssociatedPC [ | scdbg newPc newNode realPC realNode | @@ -737,7 +739,7 @@ SindarinDebuggerTest >> testMoveToNodeKeepsStackWhenAimedNodeIsMethodNodeThatDoe identicalTo: (scdbg methodNode sourceNodeForPC: scdbg pc) ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMoveToNodeRaisesErrorWhenNodeIsNotIdenticalToANodeInMethod [ | oldNode sdbg aimedNode | @@ -765,7 +767,7 @@ SindarinDebuggerTest >> testMoveToNodeRaisesErrorWhenNodeIsNotIdenticalToANodeIn assert: sdbg node equals: oldNode ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMoveToNodeRaisesErrorWhenNodeIsNotInMethod [ | oldNode sdbg | @@ -791,7 +793,7 @@ SindarinDebuggerTest >> testMoveToNodeRaisesErrorWhenNodeIsNotInMethod [ assert: sdbg node equals: oldNode ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMoveToNodeWhenFromNonInlinedBlockToOuterContext [ | oldNode sdbg aimedNode oldContext aimedPC methodNode | @@ -840,7 +842,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenFromNonInlinedBlockToOuterContext [ self assert: sdbg topStack equals: 1 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMoveToNodeWhenFromNonInlinedEmbeddedBlockToHomeContext [ | oldNode sdbg aimedNode oldContext aimedPC methodNode | @@ -889,7 +891,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenFromNonInlinedEmbeddedBlockToHomeConte self assert: sdbg topStack equals: 1 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMoveToNodeWhenFromNonInlinedEmbeddedBlockToNodeThatIsNotInHomeContext [ | oldNode oldPC sdbg aimedNode oldContext aimedPC methodNode | @@ -943,7 +945,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenFromNonInlinedEmbeddedBlockToNodeThatI self assert: sdbg topStack equals: 2 ] -{ #category : #helpers } +{ #category : 'helpers' } SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInBlockThatCreatesContextAndBlockCreationIsFirstBytecodeInFirstStatement [ | aimedBlock sdbg aimedNode | @@ -980,7 +982,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInBlockThatCreatesContextAndBloc self assert: (sdbg readVariableNamed: #a) identicalTo: 4 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInBlockThatCreatesContextAndBlockHasBeenCreated [ | oldNode sdbg aimedNode oldContext aimedPC | @@ -1026,7 +1028,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInBlockThatCreatesContextAndBloc self assert: sdbg topStack equals: 2 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInBlockThatCreatesContextAndBlockHasBeenCreatedBackward [ | oldNode sdbg aimedNode oldContext aimedPC | @@ -1071,7 +1073,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInBlockThatCreatesContextAndBloc self assert: sdbg topStack equals: 2 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInIfTrueIfFalseBlock [ | oldNode sdbg aimedNode oldContext aimedPC | @@ -1109,7 +1111,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInIfTrueIfFalseBlock [ self assert: (sdbg readVariableNamed: #a) equals: 4 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMoveToNodeWhenNodeIsLiteralOrVariableExecutesAssociatedBytecodesBecauseRelatedToStack [ | oldNode sdbg aimedNode siblingsAfterAimedNode indexOfAimedNode realNode indexOfRealNode | @@ -1141,7 +1143,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenNodeIsLiteralOrVariableExecutesAssocia self deny: (realNode isLiteralNode or: [ realNode isVariable ]) ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMoveToNodeWhenNodeIsLiteralOrVariableThatHasNoAssociatedBytecodesMovesToNextNodeThatIsNotLiteralNorVariableThatHasAnAssociatedPC [ | oldNode sdbg aimedNode siblingsAfterAimedNode indexOfAimedNode realNode indexOfRealNode | @@ -1182,7 +1184,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenNodeIsLiteralOrVariableThatHasNoAssoci deny: (sdbg methodNode pcsForNode: realNode) isEmpty ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testMoveToNodeWhenNodeIsNonInlinedAndEmbeddedInNonInlinedBlock [ | oldNode sdbg aimedNode oldContext aimedPC methodNode | @@ -1238,7 +1240,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenNodeIsNonInlinedAndEmbeddedInNonInline self assert: sdbg context identicalTo: oldContext. ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testNode [ | node scdbg | scdbg := SindarinDebugger debug: [ self methodWithTwoAssignments ]. @@ -1256,7 +1258,7 @@ SindarinDebuggerTest >> testNode [ self assert: node selector equals: #asInteger ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testPc [ | dbg | dbg := SindarinDebugger @@ -1267,7 +1269,7 @@ SindarinDebuggerTest >> testPc [ self assert: dbg pc equals: dbg context pc ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testReceiver [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -1278,7 +1280,7 @@ SindarinDebuggerTest >> testReceiver [ self assert: scdbg receiver equals: '3' ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testSelector [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -1289,7 +1291,7 @@ SindarinDebuggerTest >> testSelector [ self assert: scdbg selector equals: #asInteger ] -{ #category : #'tests - skipping' } +{ #category : 'tests - skipping' } SindarinDebuggerTest >> testSkip [ | a p scdbg | a := 1. @@ -1303,7 +1305,7 @@ SindarinDebuggerTest >> testSkip [ self assert: p equals: Point ] -{ #category : #'tests - skipping' } +{ #category : 'tests - skipping' } SindarinDebuggerTest >> testSkipAssignmentWithStoreIntoBytecodePushesReplacementValueButNotWithPopIntoBytecode [ | a b dbg aFormerValue bFormerValue | @@ -1332,7 +1334,7 @@ SindarinDebuggerTest >> testSkipAssignmentWithStoreIntoBytecodePushesReplacement self assert: a equals: aFormerValue ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testSkipBlockNode [ | scdbg targetContext | @@ -1372,7 +1374,7 @@ SindarinDebuggerTest >> testSkipBlockNode [ self assert: scdbg topStack equals: 43 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testSkipCanSkipReturnIfItIsNotTheLastReturn [ | scdbg | @@ -1396,7 +1398,7 @@ SindarinDebuggerTest >> testSkipCanSkipReturnIfItIsNotTheLastReturn [ self assert: scdbg node value value equals: 2 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testSkipCannotSkipReturnIfItIsTheLastReturn [ | scdbg nodeWithImplicitReturn | @@ -1418,7 +1420,7 @@ SindarinDebuggerTest >> testSkipCannotSkipReturnIfItIsTheLastReturn [ self assert: scdbg instructionStream willReturn ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testSkipDoesNotSkipReturn [ | a scdbg | @@ -1428,7 +1430,7 @@ SindarinDebuggerTest >> testSkipDoesNotSkipReturn [ self should: [ scdbg skip ] raise: SindarinSkippingReturnWarning ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testSkipSkipsMessagesByPuttingReceiverOnStack [ | a scdbg | @@ -1443,7 +1445,7 @@ SindarinDebuggerTest >> testSkipSkipsMessagesByPuttingReceiverOnStack [ self assert: a equals: 1 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testSkipSkipsSuperSendBytecodesCorrectly [ | a scdbg oldValueOfA negatedContext | @@ -1462,7 +1464,7 @@ SindarinDebuggerTest >> testSkipSkipsSuperSendBytecodesCorrectly [ self assert: a equals: oldValueOfA ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testSkipStepsMethodNodes [ | scdbg realExecNode realExecPc realTopStack | @@ -1488,7 +1490,7 @@ SindarinDebuggerTest >> testSkipStepsMethodNodes [ self assert: scdbg topStack equals: realTopStack ] -{ #category : #'tests - skipping' } +{ #category : 'tests - skipping' } SindarinDebuggerTest >> testSkipThroughNode [ | dbg realExecPC realValueOfA targetExecNode realExecTopStack nodeAfterSkipThrough | @@ -1515,7 +1517,7 @@ SindarinDebuggerTest >> testSkipThroughNode [ self assert: dbg topStack equals: '3' ] -{ #category : #'tests - skipping' } +{ #category : 'tests - skipping' } SindarinDebuggerTest >> testSkipToPC [ | dbg realExecPC realValueOfA realExecNode realExecTopStack | @@ -1538,7 +1540,7 @@ SindarinDebuggerTest >> testSkipToPC [ self assert: dbg topStack equals: realExecTopStack ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testSkipToPcDoesNotLoopWhenAimedPcIsAfterEndPc [ | sdbg aimedPc pcBeforeSkip | @@ -1557,7 +1559,7 @@ SindarinDebuggerTest >> testSkipToPcDoesNotLoopWhenAimedPcIsAfterEndPc [ self assert: sdbg pc equals: sdbg context endPC. ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testSkipToPcDoesNotLoopWhenAimedPcIsBeforeCurrentPc [ | sdbg aimedPc pcBeforeSkip | @@ -1577,7 +1579,7 @@ SindarinDebuggerTest >> testSkipToPcDoesNotLoopWhenAimedPcIsBeforeCurrentPc [ self assert: sdbg pc equals: pcBeforeSkip. ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testSkipUpToIgnoresJumps [ | sdbg aimedNode aimedPC a | @@ -1630,7 +1632,7 @@ SindarinDebuggerTest >> testSkipUpToIgnoresJumps [ assert: sdbg pc equals: aimedPC ] -{ #category : #'tests - skipping' } +{ #category : 'tests - skipping' } SindarinDebuggerTest >> testSkipUpToNode [ | dbg realExecPC realValueOfA realExecNode realExecTopStack | @@ -1653,7 +1655,7 @@ SindarinDebuggerTest >> testSkipUpToNode [ self assert: dbg topStack equals: realExecTopStack ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testSkipUpToNodeDoesNotLoopWhenAimedNodeIsBeforeCurrentNode [ | sdbg aimedNode nodeBeforeSkip | @@ -1672,7 +1674,7 @@ SindarinDebuggerTest >> testSkipUpToNodeDoesNotLoopWhenAimedNodeIsBeforeCurrentN self assert: sdbg node identicalTo: nodeBeforeSkip ] -{ #category : #'tests - skipping' } +{ #category : 'tests - skipping' } SindarinDebuggerTest >> testSkipUpToNodeInEvaluatedBlock [ | dbg realExecPC realExecNode realExecTopStack oldValueOfA valueOfBAfterSkipAndStep | @@ -1718,7 +1720,7 @@ SindarinDebuggerTest >> testSkipUpToNodeInEvaluatedBlock [ self assert: (dbg readVariableNamed: #b) equals: valueOfBAfterSkipAndStep ] -{ #category : #'tests - skipping' } +{ #category : 'tests - skipping' } SindarinDebuggerTest >> testSkipUpToNodeStopsOnImplicitReturnIfAimedNodeCanStillBeExecuted [ | scdbg implicitReturnPc implicitReturnNode realExecPc realExecNode | @@ -1760,7 +1762,7 @@ SindarinDebuggerTest >> testSkipUpToNodeStopsOnImplicitReturnIfAimedNodeCanStill self assert: scdbg node identicalTo: implicitReturnNode ] -{ #category : #'tests - skipping' } +{ #category : 'tests - skipping' } SindarinDebuggerTest >> testSkipUpToNodeStopsOnReturnNodes [ | scdbg returnInBlock realExecNode | @@ -1790,7 +1792,7 @@ SindarinDebuggerTest >> testSkipUpToNodeStopsOnReturnNodes [ self assert: scdbg node identicalTo: returnInBlock ] -{ #category : #'tests - skipping' } +{ #category : 'tests - skipping' } SindarinDebuggerTest >> testSkipWith [ | a p scdbg | @@ -1805,7 +1807,7 @@ SindarinDebuggerTest >> testSkipWith [ self assert: p equals: 5 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testStack [ | contextStoreBlock contextHere calleeContext scdbg | @@ -1832,7 +1834,7 @@ SindarinDebuggerTest >> testStack [ self assert: scdbg stack second identicalTo: contextHere ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testStatementNodeContaining [ | sdbg | @@ -1842,7 +1844,7 @@ SindarinDebuggerTest >> testStatementNodeContaining [ self assert: (sdbg statementNodeContaining: sdbg node) identicalTo: sdbg methodNode statements last ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testStatementNodeContainingReturnsStatementNodeThatContainsTheIdenticalSubtree [ | sdbg | @@ -1855,7 +1857,7 @@ SindarinDebuggerTest >> testStatementNodeContainingReturnsStatementNodeThatConta raise: NodeNotInASTError ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testStatementNodeContainingWhenNodeIsNotInAST [ | sdbg | @@ -1867,7 +1869,7 @@ SindarinDebuggerTest >> testStatementNodeContainingWhenNodeIsNotInAST [ raise: NodeNotInASTError ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testStep [ | node scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -1881,7 +1883,7 @@ SindarinDebuggerTest >> testStep [ self assert: node selector equals: #asInteger ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testStepOver [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -1892,7 +1894,7 @@ SindarinDebuggerTest >> testStepOver [ self assert: scdbg node selector equals: #x:y: ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testStepOverFinishedExecution [ "This test tries to show is that using Sindarin on a block, it should raise an exception if you continue stepping over that code in your Sindarin script while the execution of that code is already finished (nothing more to step)" @@ -1904,7 +1906,7 @@ SindarinDebuggerTest >> testStepOverFinishedExecution [ self should: [scdbg stepOver] raise: DebuggedExecutionIsFinished ] -{ #category : #'tests - step return' } +{ #category : 'tests - step return' } SindarinDebuggerTest >> testStepToImplicitReturn [ | dbg | @@ -1921,7 +1923,7 @@ SindarinDebuggerTest >> testStepToImplicitReturn [ ] -{ #category : #'tests - step return' } +{ #category : 'tests - step return' } SindarinDebuggerTest >> testStepToMethodEntry [ | dbg | @@ -1934,7 +1936,7 @@ SindarinDebuggerTest >> testStepToMethodEntry [ ] -{ #category : #'tests - step return' } +{ #category : 'tests - step return' } SindarinDebuggerTest >> testStepToNonLocalReturn [ | dbg | @@ -1950,7 +1952,7 @@ SindarinDebuggerTest >> testStepToNonLocalReturn [ ] -{ #category : #'tests - step return' } +{ #category : 'tests - step return' } SindarinDebuggerTest >> testStepToReturn [ | dbg | @@ -1973,7 +1975,7 @@ SindarinDebuggerTest >> testStepToReturn [ self assert: dbg topStack equals: 2 ] -{ #category : #'tests - step return' } +{ #category : 'tests - step return' } SindarinDebuggerTest >> testStepToReturnWithException [ | dbg | @@ -1986,7 +1988,7 @@ SindarinDebuggerTest >> testStepToReturnWithException [ self assert: dbg method equals: (Exception >> #signal) ] -{ #category : #'tests - step return' } +{ #category : 'tests - step return' } SindarinDebuggerTest >> testStepToReturnWithHalt [ | dbg | "First return node" @@ -1999,7 +2001,7 @@ SindarinDebuggerTest >> testStepToReturnWithHalt [ self assert: dbg topStack equals: 1 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testStepUntil [ | i scdbg | i := 20. @@ -2009,7 +2011,7 @@ SindarinDebuggerTest >> testStepUntil [ self assert: i equals: 12 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testSteppingAnExecutionSignalingExceptions [ | scdbg | scdbg := SindarinDebugger @@ -2024,7 +2026,7 @@ SindarinDebuggerTest >> testSteppingAnExecutionSignalingExceptions [ raise: UnhandledExceptionSignalledByADebuggedExecution ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testTemporaryNamed [ | dbg | dbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -2034,7 +2036,7 @@ SindarinDebuggerTest >> testTemporaryNamed [ self assert: (dbg readVariableNamed: #a) equals: 5 ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testTerminate [ | dbg | dbg := SindarinDebugger debug: [ self helperMethod13 ]. @@ -2045,7 +2047,7 @@ SindarinDebuggerTest >> testTerminate [ self assert: dbg debugSession interruptedProcess isNil. ] -{ #category : #tests } +{ #category : 'tests' } SindarinDebuggerTest >> testTopStack [ | a dbg | a := 1. @@ -2054,7 +2056,7 @@ SindarinDebuggerTest >> testTopStack [ self assert: dbg topStack equals: 2 ] -{ #category : #'tests - skipping' } +{ #category : 'tests - skipping' } SindarinDebuggerTest >> testskipUpToNodeSkipTargetNode [ "The tested method takes two params: - the node up to which we want to skip execution diff --git a/src/Sindarin-Tests/package.st b/src/Sindarin-Tests/package.st index 1be05d2..ba54db8 100644 --- a/src/Sindarin-Tests/package.st +++ b/src/Sindarin-Tests/package.st @@ -1 +1 @@ -Package { #name : #'Sindarin-Tests' } +Package { #name : 'Sindarin-Tests' } From eae1abed0d0b9265f9b6d2e203bd6a8a3c5d6b13 Mon Sep 17 00:00:00 2001 From: Marcus Denker Date: Fri, 29 Mar 2024 16:38:12 +0100 Subject: [PATCH 7/7] Revert "Fix #87. Update a test to use the new name of a method" --- .../SindarinDebugSessionMock.class.st | 34 ++- .../SindarinDebugSessionTest.class.st | 16 +- .../SindarinDebuggerTest.class.st | 220 +++++++++--------- src/Sindarin-Tests/package.st | 2 +- 4 files changed, 133 insertions(+), 139 deletions(-) diff --git a/src/Sindarin-Tests/SindarinDebugSessionMock.class.st b/src/Sindarin-Tests/SindarinDebugSessionMock.class.st index c24dbda..2d5a92a 100644 --- a/src/Sindarin-Tests/SindarinDebugSessionMock.class.st +++ b/src/Sindarin-Tests/SindarinDebugSessionMock.class.st @@ -2,82 +2,80 @@ I mock sindarin debug sessions to control it finely during tests " Class { - #name : 'SindarinDebugSessionMock', - #superclass : 'Object', + #name : #SindarinDebugSessionMock, + #superclass : #Object, #instVars : [ 'isMessage', 'selector', 'receiver' ], - #category : 'Sindarin-Tests-Mocks', - #package : 'Sindarin-Tests', - #tag : 'Mocks' + #category : #'Sindarin-Tests-Mocks' } -{ #category : 'accessing' } +{ #category : #accessing } SindarinDebugSessionMock >> context [ ^self ] -{ #category : 'accessing' } +{ #category : #accessing } SindarinDebugSessionMock >> debugSession [ ^self ] -{ #category : 'accessing' } +{ #category : #accessing } SindarinDebugSessionMock >> interruptedContext [ ^self ] -{ #category : 'accessing' } +{ #category : #accessing } SindarinDebugSessionMock >> isMessage [ ^isMessage ifNil:[false] ] -{ #category : 'accessing' } +{ #category : #accessing } SindarinDebugSessionMock >> isMessage: anObject [ isMessage := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } SindarinDebugSessionMock >> method [ ^self ] -{ #category : 'accessing' } +{ #category : #accessing } SindarinDebugSessionMock >> pc [ ^self ] -{ #category : 'accessing' } +{ #category : #accessing } SindarinDebugSessionMock >> receiver [ ^receiver ] -{ #category : 'accessing' } +{ #category : #accessing } SindarinDebugSessionMock >> receiver: anObject [ receiver := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } SindarinDebugSessionMock >> selector [ ^selector ] -{ #category : 'accessing' } +{ #category : #accessing } SindarinDebugSessionMock >> selector: anObject [ selector := anObject ] -{ #category : 'accessing' } +{ #category : #accessing } SindarinDebugSessionMock >> sourceNodeExecuted [ ^self ] -{ #category : 'accessing' } +{ #category : #accessing } SindarinDebugSessionMock >> sourceNodeForPC: pc [ ^self ] diff --git a/src/Sindarin-Tests/SindarinDebugSessionTest.class.st b/src/Sindarin-Tests/SindarinDebugSessionTest.class.st index b3d6381..1e7e05c 100644 --- a/src/Sindarin-Tests/SindarinDebugSessionTest.class.st +++ b/src/Sindarin-Tests/SindarinDebugSessionTest.class.st @@ -1,16 +1,14 @@ Class { - #name : 'SindarinDebugSessionTest', - #superclass : 'TestCase', + #name : #SindarinDebugSessionTest, + #superclass : #TestCase, #instVars : [ 'debugSession', 'sindarinSession' ], - #category : 'Sindarin-Tests-Base', - #package : 'Sindarin-Tests', - #tag : 'Base' + #category : #'Sindarin-Tests-Base' } -{ #category : 'running' } +{ #category : #running } SindarinDebugSessionTest >> setUp [ "Hooks that subclasses may override to define the fixture of test." @@ -19,13 +17,13 @@ SindarinDebugSessionTest >> setUp [ sindarinSession := debugSession asSindarinDebugSession ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebugSessionTest >> testDebugSessionAsSindarinDebugSession [ self assert: sindarinSession debugSession identicalTo: debugSession ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebugSessionTest >> testSindarinSessionAsSindarinDebugSession [ self @@ -33,7 +31,7 @@ SindarinDebugSessionTest >> testSindarinSessionAsSindarinDebugSession [ identicalTo: sindarinSession ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebugSessionTest >> testSindarinSessionInstantiation [ | sessionName process | diff --git a/src/Sindarin-Tests/SindarinDebuggerTest.class.st b/src/Sindarin-Tests/SindarinDebuggerTest.class.st index 9922a36..a90d944 100644 --- a/src/Sindarin-Tests/SindarinDebuggerTest.class.st +++ b/src/Sindarin-Tests/SindarinDebuggerTest.class.st @@ -1,15 +1,13 @@ Class { - #name : 'SindarinDebuggerTest', - #superclass : 'TestCase', + #name : #SindarinDebuggerTest, + #superclass : #TestCase, #instVars : [ 'testObjectPoint' ], - #category : 'Sindarin-Tests-Base', - #package : 'Sindarin-Tests', - #tag : 'Base' + #category : #'Sindarin-Tests-Base' } -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodNonLocalReturn [ | block | block := [ ^ 42 ]. @@ -17,7 +15,7 @@ SindarinDebuggerTest >> methodNonLocalReturn [ ^ 43 ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodReturn: bool with: anObject [ | a | @@ -26,7 +24,7 @@ SindarinDebuggerTest >> methodReturn: bool with: anObject [ ^ anObject ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodReturnWithException [ | a | @@ -35,7 +33,7 @@ SindarinDebuggerTest >> methodReturnWithException [ ^ a + 1 ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodReturnWithHalt [ @@ -45,7 +43,7 @@ SindarinDebuggerTest >> methodReturnWithHalt [ ^ a + 1 ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodWithBlockWithNoReturn [ | block a | @@ -54,20 +52,20 @@ SindarinDebuggerTest >> methodWithBlockWithNoReturn [ ^ 43 ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodWithContextPassedToBlockParameter: storeContextBlock [ storeContextBlock value: thisContext ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodWithDoubleAssignment [ | b a | a := b := 1 ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodWithEmbeddedBlock [ | a | @@ -77,7 +75,7 @@ SindarinDebuggerTest >> methodWithEmbeddedBlock [ ^ a * 42 ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodWithEvaluatedBlock [ | a b block | @@ -88,7 +86,7 @@ SindarinDebuggerTest >> methodWithEvaluatedBlock [ ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodWithIfTrueBlock [ | a | @@ -97,7 +95,7 @@ SindarinDebuggerTest >> methodWithIfTrueBlock [ a := 4 ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> methodWithIfTrueIfFalse [ | a | @@ -108,7 +106,7 @@ SindarinDebuggerTest >> methodWithIfTrueIfFalse [ a := 3 ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodWithImplicitReturn [ testObjectPoint sign. @@ -116,7 +114,7 @@ SindarinDebuggerTest >> methodWithImplicitReturn [ Point new ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodWithNotEvaluatedBlock [ | a | @@ -126,7 +124,7 @@ SindarinDebuggerTest >> methodWithNotEvaluatedBlock [ ^ a * 42 ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodWithNotEvaluatedBlockWhoseCreationIsFirstBytecodeInFirstStatement [ | a block | @@ -136,7 +134,7 @@ SindarinDebuggerTest >> methodWithNotEvaluatedBlockWhoseCreationIsFirstBytecodeI ^ a * 42 ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodWithOneAssignment [ | a | @@ -144,7 +142,7 @@ SindarinDebuggerTest >> methodWithOneAssignment [ ^ Point x: 5 y: '3' asInteger ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodWithSeveralInstructionsInBlock [ | a b block | @@ -157,7 +155,7 @@ SindarinDebuggerTest >> methodWithSeveralInstructionsInBlock [ ^ 42 ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodWithSeveralReturns [ "There is only one explicit return but there is also an implicit return after `a := 3`. In that sense, there are several returns in this method" @@ -169,7 +167,7 @@ SindarinDebuggerTest >> methodWithSeveralReturns [ a := 3 ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> methodWithTwoAssignments [ | a | @@ -178,12 +176,12 @@ SindarinDebuggerTest >> methodWithTwoAssignments [ ^ Point x: 5 y: '3' asInteger ] -{ #category : 'running' } +{ #category : #running } SindarinDebuggerTest >> runCaseManaged [ ^ self runCase ] -{ #category : 'running' } +{ #category : #running } SindarinDebuggerTest >> setUp [ "Hooks that subclasses may override to define the fixture of test." @@ -192,13 +190,13 @@ SindarinDebuggerTest >> setUp [ testObjectPoint := Point x: 1 y: 2 ] -{ #category : 'running' } +{ #category : #running } SindarinDebuggerTest >> tearDown [ super tearDown ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testArguments [ | p scdbg | p := Point new. @@ -210,7 +208,7 @@ SindarinDebuggerTest >> testArguments [ ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testAssignmentValue [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -218,7 +216,7 @@ SindarinDebuggerTest >> testAssignmentValue [ self assert: scdbg assignmentValue equals: 5 ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testAssignmentVariableName [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -226,7 +224,7 @@ SindarinDebuggerTest >> testAssignmentVariableName [ self assert: scdbg assignmentVariableName equals: #a ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testCanStillExecuteWhenAimedNodePcIsAfterInAnyContext [ | sdbg aimedNodeInContext aimedNodeOutsideContext | @@ -254,7 +252,7 @@ SindarinDebuggerTest >> testCanStillExecuteWhenAimedNodePcIsAfterInAnyContext [ self assert: (sdbg canStillExecute: aimedNodeOutsideContext) ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testCanStillExecuteWhenAimedNodePcIsBeforeInAnyContext [ | sdbg aimedNodeInContext aimedNodeOutsideContext | @@ -282,7 +280,7 @@ SindarinDebuggerTest >> testCanStillExecuteWhenAimedNodePcIsBeforeInAnyContext [ self deny: (sdbg canStillExecute: aimedNodeOutsideContext) ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testChangingPcAssociatedToMethodOrSequenceNodeKeepsStackAsItIs [ | scdbg newPc newNode expectedStackTop | @@ -303,7 +301,7 @@ SindarinDebuggerTest >> testChangingPcAssociatedToMethodOrSequenceNodeKeepsStack self assert: scdbg topStack equals: expectedStackTop ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testChangingPcInTheMiddleOfStatementSkipsTheBeginningOfStatement [ | scdbg newPc newNode expectedStackTop | @@ -338,7 +336,7 @@ SindarinDebuggerTest >> testChangingPcInTheMiddleOfStatementSkipsTheBeginningOfS self assert: scdbg topStack equals: '3' "topStack is nil because the message send asInteger to the receiver '3' has been skipped" ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testChangingPcKeepsSameStateAndPushesCorrectElementsOnStack [ | scdbg newPc newNode expectedStackTop | @@ -365,7 +363,7 @@ SindarinDebuggerTest >> testChangingPcKeepsSameStateAndPushesCorrectElementsOnSt self assert: scdbg topStack equals: expectedStackTop ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testChangingPcRaisesErrorWhenPcIsGreaterThanEndPC [ | oldPC sdbg | @@ -389,7 +387,7 @@ SindarinDebuggerTest >> testChangingPcRaisesErrorWhenPcIsGreaterThanEndPC [ assert: sdbg pc equals: oldPC ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testChangingPcRaisesErrorWhenPcIsLowerThanInitialPC [ | scdbg | @@ -412,7 +410,7 @@ SindarinDebuggerTest >> testChangingPcRaisesErrorWhenPcIsLowerThanInitialPC [ self should: [ scdbg pc: scdbg method initialPC - 1 ] raise: NotValidPcError. ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testChangingPcToNonExistingBytecodeOffsetGoesToPreviousPcWithExistingBytecodeOffset [ | scdbg newPc newNode | @@ -432,7 +430,7 @@ SindarinDebuggerTest >> testChangingPcToNonExistingBytecodeOffsetGoesToPreviousP self assert: scdbg pc equals: newPc - 1. ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testContext [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -441,7 +439,7 @@ SindarinDebuggerTest >> testContext [ self assert: scdbg context equals: scdbg debugSession interruptedContext ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testContinue [ | scdbg | @@ -456,7 +454,7 @@ SindarinDebuggerTest >> testContinue [ self assert: scdbg isExecutionFinished ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testContinueEncoutersAnException [ | scdbg | @@ -471,7 +469,7 @@ SindarinDebuggerTest >> testContinueEncoutersAnException [ self assert: scdbg isAboutToSignalException ] -{ #category : 'tests - execution predicates' } +{ #category : #'tests - execution predicates' } SindarinDebuggerTest >> testIsAboutToInstantiateClass [ |debugger session| @@ -506,12 +504,12 @@ SindarinDebuggerTest >> testIsAboutToInstantiateClass [ self assert: debugger isAboutToInstantiateClass. session receiver: CompiledCode. - session selector: #basicNew:header: . "Primitive 79" + session selector: #newMethod:header:. "Primitive 79" self assert: debugger isAboutToInstantiateClass ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testIsAssignment [ | scdbg | @@ -523,7 +521,7 @@ SindarinDebuggerTest >> testIsAssignment [ self deny: scdbg isAssignment ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testIsExecutionFinished [ | scdbg | @@ -537,7 +535,7 @@ SindarinDebuggerTest >> testIsExecutionFinished [ self assert: scdbg currentProcess isTerminated ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testIsMessageSend [ | scdbg | @@ -549,7 +547,7 @@ SindarinDebuggerTest >> testIsMessageSend [ self assert: scdbg isMessageSend ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMessage [ | scdbg | @@ -557,7 +555,7 @@ SindarinDebuggerTest >> testMessage [ self assert: (scdbg message: #methodWithOneAssignment) ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMessageArguments [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -568,7 +566,7 @@ SindarinDebuggerTest >> testMessageArguments [ self assert: (scdbg messageArguments at: 2) equals: 3 ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMessageReceiver [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -577,7 +575,7 @@ SindarinDebuggerTest >> testMessageReceiver [ self assert: scdbg messageReceiver equals: '3' ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMessageSelector [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -588,7 +586,7 @@ SindarinDebuggerTest >> testMessageSelector [ self assert: scdbg messageSelector equals: #x:y: ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMessageTo [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithImplicitReturn ]. @@ -606,7 +604,7 @@ SindarinDebuggerTest >> testMessageTo [ self deny: (scdbg message: #extent: to: Point new) ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMessageToInstanceOf [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithImplicitReturn ]. @@ -617,7 +615,7 @@ SindarinDebuggerTest >> testMessageToInstanceOf [ self deny: (scdbg message: #bogus toInstanceOf: Point) ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMethod [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -628,7 +626,7 @@ SindarinDebuggerTest >> testMethod [ self assert: scdbg method equals: String>>#asInteger ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMoveToNodeInTheMiddleOfStatementSkipsTheBeginningOfStatement [ | scdbg newPc newNode expectedStackTop | @@ -663,7 +661,7 @@ SindarinDebuggerTest >> testMoveToNodeInTheMiddleOfStatementSkipsTheBeginningOfS self assert: scdbg topStack equals: '3' "topStack is nil because the message send asInteger to the receiver '3' has been skipped" ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMoveToNodeKeepsSameStateAndPushesCorrectElementsOnStack [ | scdbg newPc newNode expectedStackTop | @@ -690,7 +688,7 @@ SindarinDebuggerTest >> testMoveToNodeKeepsSameStateAndPushesCorrectElementsOnSt self assert: scdbg topStack equals: expectedStackTop ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMoveToNodeKeepsStackWhenAimedNodeIsMethodNode [ | scdbg newPc newNode expectedStackTop | @@ -712,7 +710,7 @@ SindarinDebuggerTest >> testMoveToNodeKeepsStackWhenAimedNodeIsMethodNode [ self assert: scdbg topStack equals: expectedStackTop ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMoveToNodeKeepsStackWhenAimedNodeIsMethodNodeThatDoesNotHaveAssociatedPC [ | scdbg newPc newNode realPC realNode | @@ -739,7 +737,7 @@ SindarinDebuggerTest >> testMoveToNodeKeepsStackWhenAimedNodeIsMethodNodeThatDoe identicalTo: (scdbg methodNode sourceNodeForPC: scdbg pc) ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMoveToNodeRaisesErrorWhenNodeIsNotIdenticalToANodeInMethod [ | oldNode sdbg aimedNode | @@ -767,7 +765,7 @@ SindarinDebuggerTest >> testMoveToNodeRaisesErrorWhenNodeIsNotIdenticalToANodeIn assert: sdbg node equals: oldNode ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMoveToNodeRaisesErrorWhenNodeIsNotInMethod [ | oldNode sdbg | @@ -793,7 +791,7 @@ SindarinDebuggerTest >> testMoveToNodeRaisesErrorWhenNodeIsNotInMethod [ assert: sdbg node equals: oldNode ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMoveToNodeWhenFromNonInlinedBlockToOuterContext [ | oldNode sdbg aimedNode oldContext aimedPC methodNode | @@ -842,7 +840,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenFromNonInlinedBlockToOuterContext [ self assert: sdbg topStack equals: 1 ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMoveToNodeWhenFromNonInlinedEmbeddedBlockToHomeContext [ | oldNode sdbg aimedNode oldContext aimedPC methodNode | @@ -891,7 +889,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenFromNonInlinedEmbeddedBlockToHomeConte self assert: sdbg topStack equals: 1 ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMoveToNodeWhenFromNonInlinedEmbeddedBlockToNodeThatIsNotInHomeContext [ | oldNode oldPC sdbg aimedNode oldContext aimedPC methodNode | @@ -945,7 +943,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenFromNonInlinedEmbeddedBlockToNodeThatI self assert: sdbg topStack equals: 2 ] -{ #category : 'helpers' } +{ #category : #helpers } SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInBlockThatCreatesContextAndBlockCreationIsFirstBytecodeInFirstStatement [ | aimedBlock sdbg aimedNode | @@ -982,7 +980,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInBlockThatCreatesContextAndBloc self assert: (sdbg readVariableNamed: #a) identicalTo: 4 ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInBlockThatCreatesContextAndBlockHasBeenCreated [ | oldNode sdbg aimedNode oldContext aimedPC | @@ -1028,7 +1026,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInBlockThatCreatesContextAndBloc self assert: sdbg topStack equals: 2 ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInBlockThatCreatesContextAndBlockHasBeenCreatedBackward [ | oldNode sdbg aimedNode oldContext aimedPC | @@ -1073,7 +1071,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInBlockThatCreatesContextAndBloc self assert: sdbg topStack equals: 2 ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInIfTrueIfFalseBlock [ | oldNode sdbg aimedNode oldContext aimedPC | @@ -1111,7 +1109,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenNodeIsInIfTrueIfFalseBlock [ self assert: (sdbg readVariableNamed: #a) equals: 4 ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMoveToNodeWhenNodeIsLiteralOrVariableExecutesAssociatedBytecodesBecauseRelatedToStack [ | oldNode sdbg aimedNode siblingsAfterAimedNode indexOfAimedNode realNode indexOfRealNode | @@ -1143,7 +1141,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenNodeIsLiteralOrVariableExecutesAssocia self deny: (realNode isLiteralNode or: [ realNode isVariable ]) ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMoveToNodeWhenNodeIsLiteralOrVariableThatHasNoAssociatedBytecodesMovesToNextNodeThatIsNotLiteralNorVariableThatHasAnAssociatedPC [ | oldNode sdbg aimedNode siblingsAfterAimedNode indexOfAimedNode realNode indexOfRealNode | @@ -1184,7 +1182,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenNodeIsLiteralOrVariableThatHasNoAssoci deny: (sdbg methodNode pcsForNode: realNode) isEmpty ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testMoveToNodeWhenNodeIsNonInlinedAndEmbeddedInNonInlinedBlock [ | oldNode sdbg aimedNode oldContext aimedPC methodNode | @@ -1240,7 +1238,7 @@ SindarinDebuggerTest >> testMoveToNodeWhenNodeIsNonInlinedAndEmbeddedInNonInline self assert: sdbg context identicalTo: oldContext. ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testNode [ | node scdbg | scdbg := SindarinDebugger debug: [ self methodWithTwoAssignments ]. @@ -1258,7 +1256,7 @@ SindarinDebuggerTest >> testNode [ self assert: node selector equals: #asInteger ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testPc [ | dbg | dbg := SindarinDebugger @@ -1269,7 +1267,7 @@ SindarinDebuggerTest >> testPc [ self assert: dbg pc equals: dbg context pc ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testReceiver [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -1280,7 +1278,7 @@ SindarinDebuggerTest >> testReceiver [ self assert: scdbg receiver equals: '3' ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testSelector [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -1291,7 +1289,7 @@ SindarinDebuggerTest >> testSelector [ self assert: scdbg selector equals: #asInteger ] -{ #category : 'tests - skipping' } +{ #category : #'tests - skipping' } SindarinDebuggerTest >> testSkip [ | a p scdbg | a := 1. @@ -1305,7 +1303,7 @@ SindarinDebuggerTest >> testSkip [ self assert: p equals: Point ] -{ #category : 'tests - skipping' } +{ #category : #'tests - skipping' } SindarinDebuggerTest >> testSkipAssignmentWithStoreIntoBytecodePushesReplacementValueButNotWithPopIntoBytecode [ | a b dbg aFormerValue bFormerValue | @@ -1334,7 +1332,7 @@ SindarinDebuggerTest >> testSkipAssignmentWithStoreIntoBytecodePushesReplacement self assert: a equals: aFormerValue ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testSkipBlockNode [ | scdbg targetContext | @@ -1374,7 +1372,7 @@ SindarinDebuggerTest >> testSkipBlockNode [ self assert: scdbg topStack equals: 43 ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testSkipCanSkipReturnIfItIsNotTheLastReturn [ | scdbg | @@ -1398,7 +1396,7 @@ SindarinDebuggerTest >> testSkipCanSkipReturnIfItIsNotTheLastReturn [ self assert: scdbg node value value equals: 2 ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testSkipCannotSkipReturnIfItIsTheLastReturn [ | scdbg nodeWithImplicitReturn | @@ -1420,7 +1418,7 @@ SindarinDebuggerTest >> testSkipCannotSkipReturnIfItIsTheLastReturn [ self assert: scdbg instructionStream willReturn ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testSkipDoesNotSkipReturn [ | a scdbg | @@ -1430,7 +1428,7 @@ SindarinDebuggerTest >> testSkipDoesNotSkipReturn [ self should: [ scdbg skip ] raise: SindarinSkippingReturnWarning ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testSkipSkipsMessagesByPuttingReceiverOnStack [ | a scdbg | @@ -1445,7 +1443,7 @@ SindarinDebuggerTest >> testSkipSkipsMessagesByPuttingReceiverOnStack [ self assert: a equals: 1 ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testSkipSkipsSuperSendBytecodesCorrectly [ | a scdbg oldValueOfA negatedContext | @@ -1464,7 +1462,7 @@ SindarinDebuggerTest >> testSkipSkipsSuperSendBytecodesCorrectly [ self assert: a equals: oldValueOfA ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testSkipStepsMethodNodes [ | scdbg realExecNode realExecPc realTopStack | @@ -1490,7 +1488,7 @@ SindarinDebuggerTest >> testSkipStepsMethodNodes [ self assert: scdbg topStack equals: realTopStack ] -{ #category : 'tests - skipping' } +{ #category : #'tests - skipping' } SindarinDebuggerTest >> testSkipThroughNode [ | dbg realExecPC realValueOfA targetExecNode realExecTopStack nodeAfterSkipThrough | @@ -1517,7 +1515,7 @@ SindarinDebuggerTest >> testSkipThroughNode [ self assert: dbg topStack equals: '3' ] -{ #category : 'tests - skipping' } +{ #category : #'tests - skipping' } SindarinDebuggerTest >> testSkipToPC [ | dbg realExecPC realValueOfA realExecNode realExecTopStack | @@ -1540,7 +1538,7 @@ SindarinDebuggerTest >> testSkipToPC [ self assert: dbg topStack equals: realExecTopStack ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testSkipToPcDoesNotLoopWhenAimedPcIsAfterEndPc [ | sdbg aimedPc pcBeforeSkip | @@ -1559,7 +1557,7 @@ SindarinDebuggerTest >> testSkipToPcDoesNotLoopWhenAimedPcIsAfterEndPc [ self assert: sdbg pc equals: sdbg context endPC. ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testSkipToPcDoesNotLoopWhenAimedPcIsBeforeCurrentPc [ | sdbg aimedPc pcBeforeSkip | @@ -1579,7 +1577,7 @@ SindarinDebuggerTest >> testSkipToPcDoesNotLoopWhenAimedPcIsBeforeCurrentPc [ self assert: sdbg pc equals: pcBeforeSkip. ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testSkipUpToIgnoresJumps [ | sdbg aimedNode aimedPC a | @@ -1632,7 +1630,7 @@ SindarinDebuggerTest >> testSkipUpToIgnoresJumps [ assert: sdbg pc equals: aimedPC ] -{ #category : 'tests - skipping' } +{ #category : #'tests - skipping' } SindarinDebuggerTest >> testSkipUpToNode [ | dbg realExecPC realValueOfA realExecNode realExecTopStack | @@ -1655,7 +1653,7 @@ SindarinDebuggerTest >> testSkipUpToNode [ self assert: dbg topStack equals: realExecTopStack ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testSkipUpToNodeDoesNotLoopWhenAimedNodeIsBeforeCurrentNode [ | sdbg aimedNode nodeBeforeSkip | @@ -1674,7 +1672,7 @@ SindarinDebuggerTest >> testSkipUpToNodeDoesNotLoopWhenAimedNodeIsBeforeCurrentN self assert: sdbg node identicalTo: nodeBeforeSkip ] -{ #category : 'tests - skipping' } +{ #category : #'tests - skipping' } SindarinDebuggerTest >> testSkipUpToNodeInEvaluatedBlock [ | dbg realExecPC realExecNode realExecTopStack oldValueOfA valueOfBAfterSkipAndStep | @@ -1720,7 +1718,7 @@ SindarinDebuggerTest >> testSkipUpToNodeInEvaluatedBlock [ self assert: (dbg readVariableNamed: #b) equals: valueOfBAfterSkipAndStep ] -{ #category : 'tests - skipping' } +{ #category : #'tests - skipping' } SindarinDebuggerTest >> testSkipUpToNodeStopsOnImplicitReturnIfAimedNodeCanStillBeExecuted [ | scdbg implicitReturnPc implicitReturnNode realExecPc realExecNode | @@ -1762,7 +1760,7 @@ SindarinDebuggerTest >> testSkipUpToNodeStopsOnImplicitReturnIfAimedNodeCanStill self assert: scdbg node identicalTo: implicitReturnNode ] -{ #category : 'tests - skipping' } +{ #category : #'tests - skipping' } SindarinDebuggerTest >> testSkipUpToNodeStopsOnReturnNodes [ | scdbg returnInBlock realExecNode | @@ -1792,7 +1790,7 @@ SindarinDebuggerTest >> testSkipUpToNodeStopsOnReturnNodes [ self assert: scdbg node identicalTo: returnInBlock ] -{ #category : 'tests - skipping' } +{ #category : #'tests - skipping' } SindarinDebuggerTest >> testSkipWith [ | a p scdbg | @@ -1807,7 +1805,7 @@ SindarinDebuggerTest >> testSkipWith [ self assert: p equals: 5 ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testStack [ | contextStoreBlock contextHere calleeContext scdbg | @@ -1834,7 +1832,7 @@ SindarinDebuggerTest >> testStack [ self assert: scdbg stack second identicalTo: contextHere ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testStatementNodeContaining [ | sdbg | @@ -1844,7 +1842,7 @@ SindarinDebuggerTest >> testStatementNodeContaining [ self assert: (sdbg statementNodeContaining: sdbg node) identicalTo: sdbg methodNode statements last ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testStatementNodeContainingReturnsStatementNodeThatContainsTheIdenticalSubtree [ | sdbg | @@ -1857,7 +1855,7 @@ SindarinDebuggerTest >> testStatementNodeContainingReturnsStatementNodeThatConta raise: NodeNotInASTError ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testStatementNodeContainingWhenNodeIsNotInAST [ | sdbg | @@ -1869,7 +1867,7 @@ SindarinDebuggerTest >> testStatementNodeContainingWhenNodeIsNotInAST [ raise: NodeNotInASTError ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testStep [ | node scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -1883,7 +1881,7 @@ SindarinDebuggerTest >> testStep [ self assert: node selector equals: #asInteger ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testStepOver [ | scdbg | scdbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -1894,7 +1892,7 @@ SindarinDebuggerTest >> testStepOver [ self assert: scdbg node selector equals: #x:y: ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testStepOverFinishedExecution [ "This test tries to show is that using Sindarin on a block, it should raise an exception if you continue stepping over that code in your Sindarin script while the execution of that code is already finished (nothing more to step)" @@ -1906,7 +1904,7 @@ SindarinDebuggerTest >> testStepOverFinishedExecution [ self should: [scdbg stepOver] raise: DebuggedExecutionIsFinished ] -{ #category : 'tests - step return' } +{ #category : #'tests - step return' } SindarinDebuggerTest >> testStepToImplicitReturn [ | dbg | @@ -1923,7 +1921,7 @@ SindarinDebuggerTest >> testStepToImplicitReturn [ ] -{ #category : 'tests - step return' } +{ #category : #'tests - step return' } SindarinDebuggerTest >> testStepToMethodEntry [ | dbg | @@ -1936,7 +1934,7 @@ SindarinDebuggerTest >> testStepToMethodEntry [ ] -{ #category : 'tests - step return' } +{ #category : #'tests - step return' } SindarinDebuggerTest >> testStepToNonLocalReturn [ | dbg | @@ -1952,7 +1950,7 @@ SindarinDebuggerTest >> testStepToNonLocalReturn [ ] -{ #category : 'tests - step return' } +{ #category : #'tests - step return' } SindarinDebuggerTest >> testStepToReturn [ | dbg | @@ -1975,7 +1973,7 @@ SindarinDebuggerTest >> testStepToReturn [ self assert: dbg topStack equals: 2 ] -{ #category : 'tests - step return' } +{ #category : #'tests - step return' } SindarinDebuggerTest >> testStepToReturnWithException [ | dbg | @@ -1988,7 +1986,7 @@ SindarinDebuggerTest >> testStepToReturnWithException [ self assert: dbg method equals: (Exception >> #signal) ] -{ #category : 'tests - step return' } +{ #category : #'tests - step return' } SindarinDebuggerTest >> testStepToReturnWithHalt [ | dbg | "First return node" @@ -2001,7 +1999,7 @@ SindarinDebuggerTest >> testStepToReturnWithHalt [ self assert: dbg topStack equals: 1 ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testStepUntil [ | i scdbg | i := 20. @@ -2011,7 +2009,7 @@ SindarinDebuggerTest >> testStepUntil [ self assert: i equals: 12 ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testSteppingAnExecutionSignalingExceptions [ | scdbg | scdbg := SindarinDebugger @@ -2026,7 +2024,7 @@ SindarinDebuggerTest >> testSteppingAnExecutionSignalingExceptions [ raise: UnhandledExceptionSignalledByADebuggedExecution ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testTemporaryNamed [ | dbg | dbg := SindarinDebugger debug: [ self methodWithOneAssignment ]. @@ -2036,7 +2034,7 @@ SindarinDebuggerTest >> testTemporaryNamed [ self assert: (dbg readVariableNamed: #a) equals: 5 ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testTerminate [ | dbg | dbg := SindarinDebugger debug: [ self helperMethod13 ]. @@ -2047,7 +2045,7 @@ SindarinDebuggerTest >> testTerminate [ self assert: dbg debugSession interruptedProcess isNil. ] -{ #category : 'tests' } +{ #category : #tests } SindarinDebuggerTest >> testTopStack [ | a dbg | a := 1. @@ -2056,7 +2054,7 @@ SindarinDebuggerTest >> testTopStack [ self assert: dbg topStack equals: 2 ] -{ #category : 'tests - skipping' } +{ #category : #'tests - skipping' } SindarinDebuggerTest >> testskipUpToNodeSkipTargetNode [ "The tested method takes two params: - the node up to which we want to skip execution diff --git a/src/Sindarin-Tests/package.st b/src/Sindarin-Tests/package.st index ba54db8..1be05d2 100644 --- a/src/Sindarin-Tests/package.st +++ b/src/Sindarin-Tests/package.st @@ -1 +1 @@ -Package { #name : 'Sindarin-Tests' } +Package { #name : #'Sindarin-Tests' }