[squeak-dev] The Trunk: SUnit-pre.142.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Jun 8 09:29:04 UTC 2022
Patrick Rein uploaded a new version of SUnit to project The Trunk:
http://source.squeak.org/trunk/SUnit-pre.142.mcz
==================== Summary ====================
Name: SUnit-pre.142
Author: pre
Time: 8 June 2022, 11:29:02.519975 am
UUID: c319e68f-4716-2241-a06c-c1dabf3c2919
Ancestors: SUnit-lrnp.141
Reworks targetClass and classToBeTested in ClassTestCase. #targetClass is redundant with #classToBeTested and subclasses started overriding either one. As a first step to a more consistent protocol, this commit unifies #targetClass and #classToBeTested and redirects targetClass to classToBeTested. #classToBeTested now looks for a class to test on its own, but the mechanism can be overridden to make the class explicit. In some future, usages and overrides of #targetClass should be migrated to #classToBeTested.
=============== Diff against SUnit-lrnp.141 ===============
Item was changed:
TestCase subclass: #ClassTestCase
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'SUnit-Extensions'!
+ !ClassTestCase commentStamp: 'pre 6/8/2022 11:01' prior: 0!
- !ClassTestCase commentStamp: 'brp 7/26/2003 16:57' prior: 0!
This class is intended for unit tests of individual classes and their metaclasses.
It provides methods to determine the coverage of the unit tests.
+ Subclasses are expected to re-implement #classToBeTested and #selectorsToBeIgnored.
- Subclasses are expected to re-implement #classesToBeTested and #selectorsToBeIgnored.
They should also implement to confirm that all methods have been tested.
#testCoverage
super testCoverage.
!
Item was changed:
----- Method: ClassTestCase>>classToBeTested (in category 'coverage') -----
classToBeTested
+ "When overridden this should return the class for coverage
+ and for generic class tests (see category tests)."
+ | className |
+ className := self class name asText copyFrom: 0 to: self class name size - 4.
+ ^ self class environment valueOf: (className asString asSymbol).!
-
- self subclassResponsibility!
Item was changed:
----- Method: ClassTestCase>>targetClass (in category 'private') -----
targetClass
- |className|
+ ^ self classToBeTested!
- className := self class name asText copyFrom: 0 to: self class name size - 4.
- ^ self class environment valueOf: (className asString asSymbol).
- !
Item was changed:
----- Method: ClassTestCase>>testCoverage (in category 'tests') -----
testCoverage
| untested |
+ self class mustTestCoverage ifTrue: [
+ untested := self selectorsNotTested.
+ self
+ assert: untested isEmpty
+ description: untested size asString, ' selectors are not covered']!
- self class mustTestCoverage ifTrue:
- [ untested := self selectorsNotTested.
- self assert: untested isEmpty
- description: untested size asString, ' selectors are not covered' ]!
More information about the Squeak-dev
mailing list
|