[squeak-dev] The Inbox: KernelTests-jar.430.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Jun 5 21:11:16 UTC 2022

A new version of KernelTests was added to project The Inbox:

==================== Summary ====================

Name: KernelTests-jar.430
Author: jar
Time: 5 June 2022, 11:11:12.187824 pm
UUID: 209031e0-7bc5-984a-94dd-b3c3a24216c3
Ancestors: KernelTests-jar.429

Oops, fix comment in previous test KernelTests-jar.429... Sorry for the noise.

=============== Diff against KernelTests-jar.429 ===============

Item was changed:
  ----- Method: ProcessTest>>testTerminateHandlingUnwindError (in category 'tests') -----
  	"Test an error inside an unwind block is handled correctly."
  	"Workspace example:
  		[ [[Processor activeProcess terminate] ensure: [1/0]] on: ZeroDivide do: [] ] fork
  	ZeroDivide error should get caught by the handler without opening the Debugger.
  	To model this example as a test case we have to keep in mind that an error signal 
  	in one thread cannot be caught in a different thread: if process 'p' signals an error
  	it won't be searching for a handler in the thread that sent 'p terminate' message.
  	So we can't do something like:
+ 		p := [ [ [Semaphore new wait] ensure: [1/0] ] on: ZeroDivide do: [] ] fork.
- 		p := [ [ [Semaphore new wait] ensure: unwindBlock ] on: ZeroDivide do: [] ] fork.
  		Processor yield.
  		self shouldnt: [p terminate] raise: Error
  	Instead, in order to catch the situation the ZeroDivide error is not caught within 'p',
  	we try to catch the UnhandledError raised in 'p' indicating the ZeroDivide has been
  	missed.	"
  	| p error unwindBlock |
  	unwindBlock := [[1/0] on: UnhandledError do: [error := true]].
  	p := [ [ [Semaphore new wait] ensure: unwindBlock ] on: ZeroDivide do: [] ] fork.
  	Processor yield.
  	self assert: p isBlocked. 
  	error := false.
  	p terminate.
  	self deny: error.
  	self assert: p isTerminated!

More information about the Squeak-dev mailing list