[squeak-dev] The Inbox: SUnit-ct.125.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Mon Mar 30 14:38:03 UTC 2020

Hi Christoph,

I think that this contribution is compatible with smalltalkCI. Yes. :-)

Am 30.03.2020 15:14:14 schrieb Thiede, Christoph <christoph.thiede at student.hpi.uni-potsdam.de>:
Hi Marcel,

yes, I had this in mind! :-)

But smalltalkCI won't do anything that opens a debugger, would it? At least I would not expect this.

And the rest of my changes should not destroy any existing behavior (with the exception of deprecations, which can be fixed later, too). Or do you see any reason where a semaphore does add value?

Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 30. März 2020 12:11:55
An: John Pfersich via Squeak-dev
Betreff: Re: [squeak-dev] The Inbox: SUnit-ct.125.mcz
Hi all!

Beware of making substantial changes to the public interface of TestCase or the communication between TestCase and TestResult *because* it might interfere with smalltalkCI and its efforts to remain cross-Smalltalk compatible.

So, please double-check. :-)

Am 29.03.2020 14:03:04 schrieb commits at source.squeak.org <commits at source.squeak.org>:
Christoph Thiede uploaded a new version of SUnit to project The Inbox:

==================== 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') -----
+ "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') -----
+ "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') -----
+ 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"

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].!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200330/f25caced/attachment.html>

More information about the Squeak-dev mailing list