The Inbox: SUnitTools-jr.5.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: SUnitTools-jr.5.mcz

commits-2
A new version of SUnitTools was added to project The Inbox:
http://source.squeak.org/inbox/SUnitTools-jr.5.mcz

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

Name: SUnitTools-jr.5
Author: jr
Time: 5 March 2020, 9:53:04.92876 pm
UUID: 612a0a0e-43fa-de40-8370-f5e90d767232
Ancestors: SUnitTools-tcj.4

Allow to create a new test class immediately if none is found.

=============== Diff against SUnitTools-tcj.4 ===============

Item was added:
+ ----- Method: CodeHolder>>testAskToCreateNewTest: (in category '*SUnitTools-running') -----
+ testAskToCreateNewTest: className
+ (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.
+ ^ 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]].
- (self class environment hasClassNamed: aClassName) ifFalse: ["no dice" ^ 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].!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: SUnitTools-jr.5.mcz

Christoph Thiede

Nice idea, even though you forget to have the message #translated :-)


What is the reason to use ClassBuilder instead of #subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:?


Best,

Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von [hidden email] <[hidden email]>
Gesendet: Donnerstag, 5. März 2020 21:53:02
An: [hidden email]
Betreff: [squeak-dev] The Inbox: SUnitTools-jr.5.mcz
 
A new version of SUnitTools was added to project The Inbox:
http://source.squeak.org/inbox/SUnitTools-jr.5.mcz

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

Name: SUnitTools-jr.5
Author: jr
Time: 5 March 2020, 9:53:04.92876 pm
UUID: 612a0a0e-43fa-de40-8370-f5e90d767232
Ancestors: SUnitTools-tcj.4

Allow to create a new test class immediately if none is found.

=============== Diff against SUnitTools-tcj.4 ===============

Item was added:
+ ----- Method: CodeHolder>>testAskToCreateNewTest: (in category '*SUnitTools-running') -----
+ testAskToCreateNewTest: className
+        (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.
+        ^ 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]].
-        (self class environment hasClassNamed: aClassName) ifFalse: ["no dice" ^ 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].!




Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: SUnitTools-jr.5.mcz

Jakob Reschke


Thiede, Christoph <[hidden email]> schrieb am Sa., 7. März 2020, 14:31:

What is the reason to use ClassBuilder instead of #subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:?

The ability to specify the target environment.


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: SUnitTools-jr.5.mcz

Christoph Thiede

Ah, ok :-)


Von: Squeak-dev <[hidden email]> im Auftrag von Jakob Reschke <[hidden email]>
Gesendet: Samstag, 7. März 2020 14:57:12
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] The Inbox: SUnitTools-jr.5.mcz
 


Thiede, Christoph <[hidden email]> schrieb am Sa., 7. März 2020, 14:31:

What is the reason to use ClassBuilder instead of #subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:?

The ability to specify the target environment.


Carpe Squeak!