Christoph Thiede uploaded a new version of SUnit to project The Inbox: http://source.squeak.org/inbox/SUnit-ct.125.mcz
==================== Summary ====================
Name: SUnit-ct.125 Author: ct Time: 29 March 2020, 1:02:50.60056 pm UUID: 814e778e-04dc-954c-93e3-fb19e307d4c8 Ancestors: SUnit-mt.121
Proposal: Update debugging logic of TestCase. Instead of abusing #halt, open a debugger directly on the test selector. Deprecates #openDebuggerOnFailingTestMethod.
Also slightly refactors internal behavior to avoid some duplication, and to get rid of unnecessary semaphores which should not add any value compared to #ensure: unless some really low-level things are broken. Please correct me if I am wrong here!
=============== Diff against SUnit-mt.121 ===============
Item was added: + ----- Method: TestCase>>assureResourcesDuring: (in category 'private') ----- + assureResourcesDuring: aBlock + + | resources | + resources := self resources. + resources do: [:resource | + resource isAvailable ifFalse: [ + ^ resource signalInitializationError]]. + ^ aBlock ensure: [ + resources do: [:resource | + resource reset]].!
Item was changed: ----- Method: TestCase>>debug (in category 'running') ----- debug + "Run the receiver and open a debugger on the first failure or error." + + ^ self assureResourcesDuring: [self runCaseWithoutTimeout]! - self resources do: - [ : res | res isAvailable ifFalse: [ ^ res signalInitializationError ] ]. - [ self runCase ] ensure: - [ self resources do: - [ : each | each reset ] ]!
Item was changed: ----- Method: TestCase>>debugAsFailure (in category 'running') ----- debugAsFailure + "Spawn a debugger that is ready to debug the receiver." + + (Process + forBlock: [self debug] + runUntil: [:context | context selector = testSelector]) + debug.! - | semaphore | - semaphore := Semaphore new. - self resources do: [:res | - res isAvailable ifFalse: [^res signalInitializationError]]. - [semaphore wait. self resources do: [:each | each reset]] fork. - (self class selector: testSelector) runCaseAsFailure: semaphore.!
Item was changed: ----- Method: TestCase>>openDebuggerOnFailingTestMethod (in category 'running') ----- openDebuggerOnFailingTestMethod + + self deprecated: 'ct: Use #debugAsFailure'. + "SUnit has halted one step in front of the failing test method. Step over the 'self halt' and send into 'self perform: testSelector' to see the failure from the beginning" - self halt; performTest!
Item was changed: ----- Method: TestCase>>runCaseAsFailure: (in category 'running') ----- runCaseAsFailure: aSemaphore + + self deprecated: 'ct: Use #runCaseWithoutTimeout and #ensure:'. + ^ [self runCaseWithoutTimeout] + ensure: [aSemaphore signal]! - [self setUp. - self openDebuggerOnFailingTestMethod] ensure: [ - self tearDown. - aSemaphore signal]!
Item was added: + ----- Method: TestCase>>runCaseWithoutTimeout (in category 'running') ----- + runCaseWithoutTimeout + + [self setUp. + self performTest] + ensure: [self tearDown].!