<div dir="ltr">Hi,<div><br></div><div>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.</div><div><br></div><div>Kind regards,</div><div>Jakob</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Am Mi., 8. Juni 2022 um 11:29 Uhr schrieb <<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Patrick Rein uploaded a new version of SUnit to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/SUnit-pre.142.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/trunk/SUnit-pre.142.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: SUnit-pre.142<br>
Author: pre<br>
Time: 8 June 2022, 11:29:02.519975 am<br>
UUID: c319e68f-4716-2241-a06c-c1dabf3c2919<br>
Ancestors: SUnit-lrnp.141<br>
<br>
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.<br>
<br>
=============== Diff against SUnit-lrnp.141 ===============<br>
<br>
Item was changed:<br>
TestCase subclass: #ClassTestCase<br>
instanceVariableNames: ''<br>
classVariableNames: ''<br>
poolDictionaries: ''<br>
category: 'SUnit-Extensions'!<br>
<br>
+ !ClassTestCase commentStamp: 'pre 6/8/2022 11:01' prior: 0!<br>
- !ClassTestCase commentStamp: 'brp 7/26/2003 16:57' prior: 0!<br>
This class is intended for unit tests of individual classes and their metaclasses.<br>
<br>
It provides methods to determine the coverage of the unit tests.<br>
<br>
+ Subclasses are expected to re-implement #classToBeTested and #selectorsToBeIgnored.<br>
- Subclasses are expected to re-implement #classesToBeTested and #selectorsToBeIgnored.<br>
<br>
They should also implement to confirm that all methods have been tested.<br>
<br>
#testCoverage<br>
<br>
super testCoverage.<br>
<br>
!<br>
<br>
Item was changed:<br>
----- Method: ClassTestCase>>classToBeTested (in category 'coverage') -----<br>
classToBeTested<br>
+ "When overridden this should return the class for coverage <br>
+ and for generic class tests (see category tests)."<br>
+ | className |<br>
+ className := self class name asText copyFrom: 0 to: self class name size - 4.<br>
+ ^ self class environment valueOf: (className asString asSymbol).!<br>
- <br>
- self subclassResponsibility!<br>
<br>
Item was changed:<br>
----- Method: ClassTestCase>>targetClass (in category 'private') -----<br>
targetClass<br>
- |className|<br>
<br>
+ ^ self classToBeTested!<br>
- className := self class name asText copyFrom: 0 to: self class name size - 4.<br>
- ^ self class environment valueOf: (className asString asSymbol).<br>
- !<br>
<br>
Item was changed:<br>
----- Method: ClassTestCase>>testCoverage (in category 'tests') -----<br>
testCoverage<br>
<br>
| untested | <br>
+ self class mustTestCoverage ifTrue: [<br>
+ untested := self selectorsNotTested.<br>
+ self <br>
+ assert: untested isEmpty <br>
+ description: untested size asString, ' selectors are not covered']!<br>
- self class mustTestCoverage ifTrue:<br>
- [ untested := self selectorsNotTested.<br>
- self assert: untested isEmpty <br>
- description: untested size asString, ' selectors are not covered' ]!<br>
<br>
<br>
</blockquote></div>