A new version of SUnitTools was added to project The Inbox:
http://source.squeak.org/inbox/SUnitTools-jr.6.mcz==================== Summary ====================
Name: SUnitTools-jr.6
Author: jr
Time: 5 March 2020, 10:10:24.44376 pm
UUID: 2cefdc56-246b-d344-9116-465f7ccc1a20
Ancestors: SUnitTools-jr.5
Preselect tests category when browsing a class without a matching test method. Create the tests category in new classes.
=============== Diff against SUnitTools-jr.5 ===============
Item was added:
+ ----- Method: BasicClassOrganizer>>categoryForTestCases (in category '*SUnitTools-accessing') -----
+ categoryForTestCases
+ ^ self categories
+ detect: [:each | each beginsWith: 'test']
+ ifNone: [Categorizer allCategory]!
Item was changed:
----- Method: CodeHolder>>testAskToCreateNewTest: (in category '*SUnitTools-running') -----
testAskToCreateNewTest: className
+ | newClass |
(self confirm: 'Test class not found. Create one?') ifFalse: [^ false].
(ClassBuilder new)
name: className asSymbol
inEnvironment: self selectedClass environment
subclassOf: TestCase
type: #normal
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category:
((self selectedClass category includes: $-)
ifTrue: [((self selectedClass category copyUpToLast: $-), '-Tests')]
ifFalse: [(self selectedClass category, 'Tests')]) asSymbol.
+ newClass := self selectedClass environment classNamed: className asSymbol.
+ newClass organization addCategory: #tests.
^ true!
Item was changed:
----- Method: CodeHolder>>testBrowseClassNamed:possibleMessageNamed: (in category '*SUnitTools-running') -----
testBrowseClassNamed: aClassName possibleMessageNamed: aMessageName
| cls selector |
(self class environment hasClassNamed: aClassName) ifFalse:
[(self testAskToCreateNewTest: aClassName) ifFalse: [^ self]].
cls := self class environment classNamed: aClassName.
(aMessageName notNil and: [cls includesLocalSelector: (selector := aMessageName asSymbol)])
ifTrue: [ToolSet browse: cls selector: selector]
+ ifFalse:
+ [ToolSet
+ browseClass: cls
+ category: cls organization categoryForTestCases].!
- ifFalse: [ToolSet browseClass: cls].!