[squeak-dev] The Trunk: SUnit-pre.142.mcz
Jakob Reschke
jakres+squeak at gmail.com
Sat Jun 18 14:34:48 UTC 2022
Hi,
It looks like projects that want to support both Squeak 5.3 and 6.0 and
need a custom class lookup now need to override both methods. Override
#targetClass so that the internal sends still work in 5.3 and override
#classToBeTested so that the internal sends work in 6.0.
Kind regards,
Jakob
Am Mi., 8. Juni 2022 um 11:29 Uhr schrieb <commits at source.squeak.org>:
> 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' ]!
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220618/1ad17a0a/attachment.html>
More information about the Squeak-dev
mailing list
|