[squeak-dev] The Trunk: SUnit-ct.138.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jan 31 19:38:29 UTC 2022


Christoph Thiede uploaded a new version of SUnit to project The Trunk:
http://source.squeak.org/trunk/SUnit-ct.138.mcz

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

Name: SUnit-ct.138
Author: ct
Time: 31 January 2022, 8:38:14.044214 pm
UUID: b34d72f7-2b2e-a642-9c1e-66cc7a361a00
Ancestors: SUnit-ct.136

Adds and tests #shouldRaiseError: as a convenience assertion that encapsulates the #exError abstraction. Adds an explaining comment on that abstraction (see TestResult exError and allErrors).

Thanks to Marcel for the discussion!

=============== Diff against SUnit-ct.136 ===============

Item was added:
+ ----- Method: SUnitExtensionsTest>>shouldRaiseErrorTest (in category 'real tests') -----
+ shouldRaiseErrorTest
+ 
+ 	self shouldRaiseError: [ TestResult exError signal: 'any kind of error' ]
+ !

Item was added:
+ ----- Method: SUnitExtensionsTest>>testShouldRaiseError (in category 'tests') -----
+ testShouldRaiseError
+ 
+ 	| testCase testResult  |
+ 	testCase := self class selector: #shouldRaiseErrorTest.
+ 	testResult := testCase run.
+ 	
+ 	self assert: (testResult passed includes: testCase).
+ 	self assert: 1 equals: testResult passed size.
+ 	self assert: testResult failures isEmpty.
+ 	self assert: testResult errors isEmpty.!

Item was added:
+ ----- Method: TestCase>>shouldRaiseError: (in category 'asserting') -----
+ shouldRaiseError: aBlock
+ 
+ 	^ self should: aBlock raise: TestResult exError
+ 			!

Item was changed:
  ----- Method: TestResult class>>allErrors (in category 'exceptions') -----
  allErrors
+ 	"Answer an exception set for all common exceptions that can be raised when a typical error is detected in Squeak. This method decouples the testing framework from the exception handling system and allows clients to convert their tests to another Smalltalk dialect easily."
  	^ self exError, Warning, Halt
  			!

Item was changed:
  ----- Method: TestResult class>>exError (in category 'exceptions') -----
  exError
+ 	"Answer the exception class that represents a regular error in Squeak. This method decouples the testing framework from the exception handling system and allows clients to convert their tests to another Smalltalk dialect easily."
  	^Error
  			!



More information about the Squeak-dev mailing list