Marcel Taeumel uploaded a new version of KernelTests to project The Trunk: http://source.squeak.org/trunk/KernelTests-jar.447.mcz
==================== Summary ====================
Name: KernelTests-jar.447 Author: jar Time: 25 November 2023, 12:03:56.598163 am UUID: d84529ef-9079-324c-8aa7-5c24c76f7dc8 Ancestors: KernelTests-jr.446
test correct behavior resumption of the BCR error; complement Kernel-jar.1537, Kernel-eem.1535 and Kernel-eem.1536
=============== Diff against KernelTests-jr.446 ===============
Item was added: + ----- Method: ProcessTest>>testResumeWithEnsureAfterBCR (in category 'tests') ----- + testResumeWithEnsureAfterBCR + "This test verifies #cannotReturn: context sender's pc has been nilled + before returning to make sure its code won't continue executing, + an unwind block will be run, and an Error will be raised. + + Without nilling the pc this example would crash the VM after resumption: + [[^ 1] on: BlockCannotReturn do: #resume ] fork + + and this example would happily execute an illegal return after resumption: + [[true ifTrue: [^ 1]] on: BlockCannotReturn do: #resume ] fork + + Note: push a fake stack top to prevent a VM crash when running this test in + an image without the amended #cannotReturn:to: nilling the receiver's pc; + the functionality of the test is not affected by this precautionary measure. " + + | expr executedReturnTwo error unwound sync | + expr := true. + executedReturnTwo := false. + error := false. + unwound := false. + sync := Semaphore new. + [ [sync signal. + [[expr ifTrue: [thisContext push: nil. ^1]. "see the note above" + executedReturnTwo := true. ^2] + ensure: [unwound := true]] + on: BlockCannotReturn + do: #resume] + on: Error + do: [error := true]] fork. + sync wait. + self deny: executedReturnTwo. + self assert: unwound. + self assert: error!
packages@lists.squeakfoundation.org