Fixed DNU error for empty classes/methods in context for CustomCodeGeneratorOrRefactoring >> availableForProgrammingLanguagesInContext:
authorJakub Nesveda <jakubnesveda@seznam.cz>
Sat, 24 Jan 2015 18:52:55 +0100
changeset 798 63fd5f12eb54
parent 797 7a2ee5cc3212
child 799 b3979623337e
Fixed DNU error for empty classes/methods in context for CustomCodeGeneratorOrRefactoring >> availableForProgrammingLanguagesInContext: Happens for NewSystemBrowser in a different state
CustomCodeGeneratorOrRefactoring.st
CustomCodeGeneratorOrRefactoringTests.st
patches/patches.rc
refactoring_custom.rc
--- a/CustomCodeGeneratorOrRefactoring.st	Sun Jan 04 16:18:13 2015 +0100
+++ b/CustomCodeGeneratorOrRefactoring.st	Sat Jan 24 18:52:55 2015 +0100
@@ -152,7 +152,7 @@
         aCustomContext selectedMethods isEmptyOrNil ifTrue: [ ^ true ].  
 
         ^ aCustomContext selectedMethods anySatisfy: [ :method | 
-            languages includes: method programmingLanguage
+            method notNil and: [ languages includes: method programmingLanguage ]
         ].
     ].
 
@@ -163,7 +163,7 @@
         aCustomContext selectedClasses isEmptyOrNil ifTrue: [ ^ true ].
 
         ^ aCustomContext selectedClasses anySatisfy: [ :class | 
-            languages includes: class programmingLanguage
+            class notNil and: [ languages includes: class programmingLanguage ]
         ].
     ].
 
@@ -172,7 +172,7 @@
 
     "Created: / 22-12-2014 / 20:34:28 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
     "Modified: / 25-12-2014 / 09:31:32 / root"
-    "Modified: / 27-12-2014 / 12:12:04 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 24-01-2015 / 18:24:49 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 availableInContext: aCustomContext
--- a/CustomCodeGeneratorOrRefactoringTests.st	Sun Jan 04 16:18:13 2015 +0100
+++ b/CustomCodeGeneratorOrRefactoringTests.st	Sat Jan 24 18:52:55 2015 +0100
@@ -25,15 +25,16 @@
 
 test_all_my_non_abstract_implementors_have_filled_label_and_description
 
-    generatorOrRefactoring class allSubclassesDo:[ :subclass |
-        subclass isAbstract ifFalse:[
+    CustomCodeGeneratorOrRefactoring allSubclassesDo:[ :subclass |
+        "Include only non abstract and non mock classes"
+        (subclass isAbstract or: [ (subclass includesSelector: #compileMockMethod:) ]) ifFalse:[
             self assert: (subclass label size) > 0.
             self assert: (subclass description size) > 0
         ]
     ]
 
     "Created: / 18-10-2014 / 13:38:59 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 10-11-2014 / 22:11:11 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified (format): / 17-01-2015 / 00:03:38 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 test_available_for_programming_languages
@@ -67,6 +68,17 @@
     "Created: / 27-12-2014 / 13:40:36 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
+test_available_for_programming_languages_in_context_filled_with_class_perspective_empty_class
+
+    context
+        perspective: CustomPerspective classPerspective;
+        selectedClasses: (Array with: nil).
+
+    self deny: (generatorOrRefactoring class availableForProgrammingLanguagesInContext: context)
+
+    "Created: / 24-01-2015 / 18:27:58 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
 test_available_for_programming_languages_in_context_filled_with_class_perspective_java
     | class |
 
@@ -137,6 +149,17 @@
     "Created: / 27-12-2014 / 12:37:16 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
+test_available_for_programming_languages_in_context_filled_with_method_perspective_and_empty_method
+
+    context
+        perspective: CustomPerspective methodPerspective;
+        selectedMethods: (Array with: nil).
+
+    self deny: (generatorOrRefactoring class availableForProgrammingLanguagesInContext: context)
+
+    "Created: / 24-01-2015 / 18:29:34 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
 test_available_for_programming_languages_in_context_filled_with_method_perspective_empty
 
     context perspective: CustomPerspective methodPerspective.
@@ -311,16 +334,16 @@
 test_generators_and_refactorings_do
     | expectedGenerators actualGenerators |
 
-    expectedGenerators := generatorOrRefactoring class allSubclasses.
+    expectedGenerators := CustomCodeGeneratorOrRefactoring allSubclasses.
     actualGenerators := OrderedCollection streamContents: [ :stream |
-        generatorOrRefactoring class generatorsAndRefactoringsDo: [ :class |
+        CustomCodeGeneratorOrRefactoring generatorsAndRefactoringsDo: [ :class |
             stream nextPut: class  
         ].
     ].
     
     self assert: expectedGenerators = actualGenerators
 
-    "Modified: / 28-12-2014 / 11:50:43 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 24-01-2015 / 18:26:23 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
 !CustomCodeGeneratorOrRefactoringTests class methodsFor:'documentation'!
--- a/patches/patches.rc	Sun Jan 04 16:18:13 2015 +0100
+++ b/patches/patches.rc	Sat Jan 24 18:52:55 2015 +0100
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
       VALUE "ProductName", "LibraryName\0"
       VALUE "ProductVersion", "6.2.5.1478\0"
-      VALUE "ProductDate", "Sun, 04 Jan 2015 15:16:53 GMT\0"
+      VALUE "ProductDate", "Sat, 24 Jan 2015 17:34:40 GMT\0"
     END
 
   END
--- a/refactoring_custom.rc	Sun Jan 04 16:18:13 2015 +0100
+++ b/refactoring_custom.rc	Sat Jan 24 18:52:55 2015 +0100
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
       VALUE "ProductName", "ProductName\0"
       VALUE "ProductVersion", "6.2.5.1478\0"
-      VALUE "ProductDate", "Sun, 04 Jan 2015 15:16:52 GMT\0"
+      VALUE "ProductDate", "Sat, 24 Jan 2015 17:34:38 GMT\0"
     END
 
   END