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

commits at source.squeak.org commits at source.squeak.org
Fri Mar 20 19:01:48 UTC 2020


Christoph Thiede uploaded a new version of SUnit to project The Inbox:
http://source.squeak.org/inbox/SUnit-ct.124.mcz

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

Name: SUnit-ct.124
Author: ct
Time: 20 March 2020, 8:01:47.398237 pm
UUID: d936b6a0-e7c7-2742-a817-35fa6511a15a
Ancestors: SUnit-mt.121

Proposal for discussion: Adds assertion message #should:raise:then: to allow for interactively working with expected exceptions. If you like, we could also talk about #should:raise:that: (however, I still like BlockClosure >> #handles:*).

Examples:

TestCase new in: [:test |
	
	test
		should: [
			test
				should: [self error: #foo]
				raise: Error
				then: #pass]
		raise: UnhandledError.
	
		test
			should: [self error: #foo]
			raise: Error
			then: [:ex |
				test assert: #foo equals: ex messageText].
	
]

* See exception patterns: http://forum.world.st/The-Inbox-Kernel-ct-1292-mcz-tp5109282p5109284.html

=============== Diff against SUnit-mt.121 ===============

Item was added:
+ ----- Method: TestCase>>should:raise:then: (in category 'accessing') -----
+ should: aBlock raise: anExceptionalEvent then: aHandlerBlock
+ 
+ 	| raised result |
+ 	raised := false.
+ 	result := aBlock
+ 		on: anExceptionalEvent
+ 		do: [:ex |
+ 			raised := true.
+ 			aHandlerBlock cull: ex].
+ 	self assert: raised.
+ 	^ result!



More information about the Squeak-dev mailing list