A new version of ToolsTests was added to project The Inbox:
http://source.squeak.org/inbox/ToolsTests-jar.105.mcz ==================== Summary ==================== Name: ToolsTests-jar.105 Author: jar Time: 24 May 2021, 3:14:58.469073 pm UUID: d928e860-c443-7943-820b-8b74e3120013 Ancestors: ToolsTests-nice.104 Complement latest #terminate in the Inbox. Test unwind semantics for nested Unhandled errors aborted via debugger's Abandon (interpreted as terminate). =============== Diff against ToolsTests-nice.104 =============== Item was added: + ----- Method: DebuggerTests>>test19ProcessUnwindsAfterDebuggerClose (in category 'tests') ----- + test19ProcessUnwindsAfterDebuggerClose + "Closing a debugger on a suspended process means terminating that process." + + | x1 x2 x3 x4 | + x1 := x2 := x3 := x4 := false. + process := + [ + [ + [ ] ensure: [ + [self error: 'outer error'] ensure: [ + x1 := true]. + x2 := true] + ] ensure: [ + x3 := true]. + x4 := true + ] fork. + Processor yield. + + "make sure process is suspended and none of the unwind blocks has finished yet" + self assert: process isSuspended. + self deny: x1 | x2 | x3 | x4. + + "now find and close the debugger and make sure all unwind blocks have finished" + self ensureDebugger. + debugger close. + + self assert: process isTerminated. + self assert: x1 & x2 & x3. + self deny: x4! Item was added: + ----- Method: DebuggerTests>>test20ProcessUnwindsAfterDebuggerClose (in category 'tests') ----- + test20ProcessUnwindsAfterDebuggerClose + "Closing a debugger on a suspended process means terminating that process." + + | x1 x2 x3 x4 | + x1 := x2 := x3 := x4 := false. + process := + [ + [ + [ ] ensure: [ + [] ensure: [ + self error: 'inner error'. + x1 := true]. + x2 := true] + ] ensure: [ + x3 := true]. + x4 := true + ] fork. + Processor yield. + + "make sure process is suspended and none of the unwind blocks has finished yet" + self assert: process isSuspended. + self deny: x1 | x2 | x3 | x4. + + "now find and close the debugger and make sure all unwind blocks have finished" + self ensureDebugger. + debugger close. + + self assert: process isTerminated. + self assert: x1 & x2 & x3. + self deny: x4! Item was added: + ----- Method: DebuggerTests>>test21ProcessUnwindsAfterDebuggerClose (in category 'tests') ----- + test21ProcessUnwindsAfterDebuggerClose + "Closing a debugger on a suspended process means terminating that process." + + | x1 x2 x3 x4 | + x1 := x2 := x3 := x4 := false. + process := + [ + [ + [ ] ensure: [ + [self error: 'outer error'] ensure: [ + self error: 'inner error'. + x1 := true]. + x2 := true] + ] ensure: [ + x3 := true]. + x4 := true + ] fork. + Processor yield. + + "make sure process is suspended and none of the unwind blocks has finished yet" + self assert: process isSuspended. + self deny: x1 | x2 | x3 | x4. + + "now find and close the debugger and let the unwind continue to the next error" + self ensureDebugger. + process := [debugger close] fork. + Processor yield. + + "make sure process is suspended and none of the unwind blocks has finished yet" + self assert: process isSuspended. + self deny: x1 | x2 | x3 | x4. + + "now find and close the debugger and make sure all unwind blocks have finished" + self ensureDebugger. + debugger close. + + self assert: process isTerminated. + self assert: x1 & x2 & x3. + self deny: x4! Item was added: + ----- Method: DebuggerTests>>test22ProcessUnwindsAfterDebuggerClose (in category 'tests') ----- + test22ProcessUnwindsAfterDebuggerClose + "Closing a debugger on a suspended process means terminating that process." + + | x1 x2 x3 x4 | + x1 := x2 := x3 := x4 := false. + process := + [ + [ + [self error: 'outer error'] ensure: [ + [self error: 'middle error'] ensure: [ + self error: 'inner error'. + x1 := true]. + x2 := true] + ] ensure: [ + x3 := true]. + x4 := true + ] fork. + Processor yield. + + "make sure process is suspended and none of the unwind blocks has finished yet" + self assert: process isSuspended. + self deny: x1 | x2 | x3 | x4. + + "now find and close the debugger and let the unwind continue to the next error" + self ensureDebugger. + process := [debugger close] fork. + Processor yield. + + "make sure process is suspended and none of the unwind blocks has finished yet" + self assert: process isSuspended. + self deny: x1 | x2 | x3 | x4. + + "now find and close the debugger and let the unwind continue to the next error" + self ensureDebugger. + process := [debugger close] fork. + Processor yield. + + "make sure process is suspended and none of the unwind blocks has finished yet" + self assert: process isSuspended. + self deny: x1 | x2 | x3 | x4. + + "now find and close the debugger and make sure all unwind blocks have finished" + self ensureDebugger. + debugger close. + + self assert: process isTerminated. + self assert: x1 & x2 & x3. + self deny: x4! |
Apart from their homogenous test names (ideally, one could grasp the idea of a test just from its name), these tests look good to describe the current situation. :-) Nevertheless, it might be wise to defer them until we have decided on whether #abandon should really use #terminate, what do you think? See [1].
Best, Christoph [1] http://forum.world.st/The-semantics-of-halfway-executed-unwind-contexts-during-process-termination-td5129800.html#a5130110
Carpe Squeak!
|
Hi Christoph,
Christoph Thiede wrote > Apart from their homogenous test names (ideally, one could grasp the idea > of a test just from its name), these tests look good to describe the > current situation. :-) Nevertheless, it might be wise to defer them until > we have decided on whether #abandon should really use #terminate, what do > you think? See [1]. > > Best, > Christoph > > [1] > http://forum.world.st/The-semantics-of-halfway-executed-unwind-contexts-during-process-termination-td5129800.html#a5130110 Yes indeed; depending on the outcome of [1] we can adjust the names and the contents. Thanks for taking a look at the tests. I wanted to learn to write them finally :) best, ----- ^[^ Jaromir -- Sent from: http://forum.world.st/Squeak-Dev-f45488.html
^[^ Jaromir
|
Free forum by Nabble | Edit this page |