Marcel Taeumel uploaded a new version of KernelTests to project The Trunk:
http://source.squeak.org/trunk/KernelTests-mt.394.mcz==================== Summary ====================
Name: KernelTests-mt.394
Author: mt
Time: 15 March 2021, 11:25:56.023586 am
UUID: 1abf5d7e-b62f-ee4d-94ea-25d3330a2905
Ancestors: KernelTests-nice.393
Complements Kernel-mt.1381
Fixes for debugger invocation during code simulation. See
http://forum.world.st/Please-try-out-Fixes-for-debugger-invocation-during-code-simulation-td5127684.html=============== Diff against KernelTests-nice.393 ===============
Item was added:
+ ----- Method: ProcessTest>>genuineProcess (in category 'support') -----
+ genuineProcess
+
+ "Usually, we don't want to expose this from the class under test."
+ ^ Processor instVarNamed: 'genuineProcess'!
Item was added:
+ ----- Method: ProcessTest>>testEvaluateOnBehalfOf (in category 'tests') -----
+ testEvaluateOnBehalfOf
+
+ | p1 p2 sem results |
+ self genuineProcess == Processor activeProcess
+ ifFalse: [self fail: 'Cannot debug this test'].
+
+ sem := Semaphore new.
+ p1 := [] newProcess.
+ p1 environmentAt: #foo put: 1.
+ p2 := [
+ Processor activeProcess environmentAt: #foo put: 2.
+ results := {
+ Processor activeProcess environmentAt: #foo.
+ self genuineProcess environmentAt: #foo.
+ Processor activeProcess
+ evaluate: [Processor activeProcess environmentAt: #foo]
+ onBehalfOf: p1.
+ Processor activeProcess
+ evaluate: [self genuineProcess environmentAt: #foo]
+ onBehalfOf: p1.
+ Processor activeProcess environmentAt: #foo }.
+ sem signal
+ ] newProcess.
+
+ p2 resume.
+ sem wait.
+
+ self assert: {2. 2. 1. 2. 2} equals: results.!
Item was added:
+ ----- Method: ProcessTest>>testProcessFaithfulRunning (in category 'tests') -----
+ testProcessFaithfulRunning
+ "While simulating a process using #runUntilErrorOrReturnFrom:, process variables should be looked up in the process being simulated. Acceptance test for process-faithful debugging, see #evaluate:onBehalfOf:."
+
+ | process result |
+ process := Process forBlock: [
+ result := Processor activeProcess environmentAt: #foo].
+ process environmentAt: #foo put: 42.
+
+ process complete: process suspendedContext.
+
+ self assert: 42 equals: result.!
Item was added:
+ ----- Method: ProcessTest>>testProcessFaithfulSimulation (in category 'tests') -----
+ testProcessFaithfulSimulation
+ "While simulating a process using the bytecode simulation machinery, process variables should be looked up in the process being simulated. Acceptance test for process-faithful debugging, see #evaluate:onBehalfOf:."
+
+ | process result |
+ process := Process forBlock: [
+ result := Processor activeProcess environmentAt: #foo].
+ process environmentAt: #foo put: 42.
+
+ process runUntil: [:context | context isDead].
+
+ self assert: 42 equals: result.!