fix error when nothing is generated
authorJakub Nesveda <jakubnesveda@seznam.cz>
Tue, 13 May 2014 22:41:19 +0200
changeset 546 7402ead9f354
parent 544 4d9dfb9b35a1
child 547 bdacc7f4986c
fix error when nothing is generated
CustomCodeGenerator.st
CustomDialogMock.st
CustomSubclassResponsibilityCodeGenerator.st
CustomSubclassResponsibilityCodeGeneratorTests.st
Make.proto
Make.spec
abbrev.stc
bc.mak
jn_refactoring_custom.st
libInit.cc
refactoring_custom.rc
--- a/CustomCodeGenerator.st	Sun May 11 15:48:51 2014 +0200
+++ b/CustomCodeGenerator.st	Tue May 13 22:41:19 2014 +0200
@@ -102,10 +102,15 @@
 !CustomCodeGenerator methodsFor:'code generation'!
 
 addBuilderChanges
+    | change |
 
-    self addChange: (builder change)
+    change := builder change.
+    change notNil ifTrue: [
+        self addChange: change 
+    ]
 
     "Created: / 10-04-2014 / 23:26:12 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 13-05-2014 / 22:10:40 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 createClass: definitionString
@@ -171,11 +176,12 @@
 
 initialize
 
+    super initialize.
     self setupBuilder.
     self setupDialog
 
     "Created: / 17-03-2014 / 22:27:32 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 10-05-2014 / 15:41:34 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 12-05-2014 / 23:30:28 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 setupBuilder
@@ -204,6 +210,16 @@
     "Modified: / 10-04-2014 / 23:07:53 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
+!CustomCodeGenerator methodsFor:'user interaction & notifications'!
+
+information: aString
+    "Much like Object >> information:, but with TestCase support"
+
+    dialog information: aString
+
+    "Created: / 13-05-2014 / 22:25:58 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
 !CustomCodeGenerator class methodsFor:'documentation'!
 
 version_HG
--- a/CustomDialogMock.st	Sun May 11 15:48:51 2014 +0200
+++ b/CustomDialogMock.st	Tue May 13 22:41:19 2014 +0200
@@ -53,3 +53,12 @@
     "Created: / 11-05-2014 / 00:19:51 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
+!CustomDialogMock methodsFor:'user interaction & notifications'!
+
+information: aString
+
+    ^ self
+
+    "Created: / 13-05-2014 / 22:33:51 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
--- a/CustomSubclassResponsibilityCodeGenerator.st	Sun May 11 15:48:51 2014 +0200
+++ b/CustomSubclassResponsibilityCodeGenerator.st	Tue May 13 22:41:19 2014 +0200
@@ -100,7 +100,7 @@
     ]
 
     "Created: / 08-04-2014 / 21:33:32 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 26-04-2014 / 17:22:54 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 13-05-2014 / 22:04:39 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 ! !
 
 !CustomSubclassResponsibilityCodeGenerator methodsFor:'queries'!
--- a/CustomSubclassResponsibilityCodeGeneratorTests.st	Sun May 11 15:48:51 2014 +0200
+++ b/CustomSubclassResponsibilityCodeGeneratorTests.st	Tue May 13 22:41:19 2014 +0200
@@ -12,11 +12,12 @@
 setUp
 
     codeGenerator := CustomSubclassResponsibilityCodeGenerator new.
+    codeGenerator dialog: CustomDialogMock new.
     mockSuperClass := self createClass: 'MockSuperClassForTestCase' superClassName: 'Object'.
     mockClass := self createClass: 'MockClassForTestCase' superClassName: (mockSuperClass new className).
 
     "Created: / 14-04-2014 / 17:16:28 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
-    "Modified: / 15-04-2014 / 20:58:45 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 13-05-2014 / 22:36:10 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
 tearDown
@@ -88,6 +89,26 @@
     "Modified: / 15-04-2014 / 21:10:56 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
 !
 
+test_none_subclass_responsibility
+    | context |
+
+    context := CustomSubContext new.
+    context addSelectedClass: mockClass.
+
+    self createMethod: mockSuperClass protocol: 'instance-protocol' source: 'instanceMethod: aParam
+    ^ self'.
+
+    self assert: (mockClass includesSelector: #instanceMethod:) not. 
+    self assert: (mockClass class includesSelector: #instanceMethod:) not.
+
+    codeGenerator executeInContext: context.
+
+    self assert: (mockClass includesSelector: #instanceMethod:) not.
+    self assert: (mockClass class includesSelector: #instanceMethod:) not.
+
+    "Created: / 13-05-2014 / 21:49:38 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
 test_subclass_responsibility_class_method
     | context |
 
--- a/Make.proto	Sun May 11 15:48:51 2014 +0200
+++ b/Make.proto	Tue May 13 22:41:19 2014 +0200
@@ -149,6 +149,7 @@
 $(OUTDIR)CustomAccessMethodsCodeGenerator.$(O) CustomAccessMethodsCodeGenerator.$(H): CustomAccessMethodsCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/stx/libtool/CodeGeneratorTool.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)CustomCodeGeneratorClassGenerator.$(O) CustomCodeGeneratorClassGenerator.$(H): CustomCodeGeneratorClassGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/stx/libtool/CodeGeneratorTool.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)CustomFooBarBazCodeGenerator.$(O) CustomFooBarBazCodeGenerator.$(H): CustomFooBarBazCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/stx/libtool/CodeGeneratorTool.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)CustomGetterMethodsCodeGenerator.$(O) CustomGetterMethodsCodeGenerator.$(H): CustomGetterMethodsCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/stx/libtool/CodeGeneratorTool.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)CustomIsAbstractCodeGenerator.$(O) CustomIsAbstractCodeGenerator.$(H): CustomIsAbstractCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/stx/libtool/CodeGeneratorTool.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)CustomSubclassResponsibilityCodeGenerator.$(O) CustomSubclassResponsibilityCodeGenerator.$(H): CustomSubclassResponsibilityCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/stx/libtool/CodeGeneratorTool.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)CustomTestCaseCodeGenerator.$(O) CustomTestCaseCodeGenerator.$(H): CustomTestCaseCodeGenerator.st $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGenerator.$(H) $(INCLUDE_TOP)/jn/refactoring_custom/CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)/stx/libtool/CodeGeneratorTool.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
--- a/Make.spec	Sun May 11 15:48:51 2014 +0200
+++ b/Make.spec	Tue May 13 22:41:19 2014 +0200
@@ -67,6 +67,7 @@
 	CustomAccessMethodsCodeGenerator \
 	CustomCodeGeneratorClassGenerator \
 	CustomFooBarBazCodeGenerator \
+	CustomGetterMethodsCodeGenerator \
 	CustomIsAbstractCodeGenerator \
 	CustomSubclassResponsibilityCodeGenerator \
 	CustomTestCaseCodeGenerator \
@@ -94,6 +95,7 @@
     $(OUTDIR_SLASH)CustomAccessMethodsCodeGenerator.$(O) \
     $(OUTDIR_SLASH)CustomCodeGeneratorClassGenerator.$(O) \
     $(OUTDIR_SLASH)CustomFooBarBazCodeGenerator.$(O) \
+    $(OUTDIR_SLASH)CustomGetterMethodsCodeGenerator.$(O) \
     $(OUTDIR_SLASH)CustomIsAbstractCodeGenerator.$(O) \
     $(OUTDIR_SLASH)CustomSubclassResponsibilityCodeGenerator.$(O) \
     $(OUTDIR_SLASH)CustomTestCaseCodeGenerator.$(O) \
--- a/abbrev.stc	Sun May 11 15:48:51 2014 +0200
+++ b/abbrev.stc	Tue May 13 22:41:19 2014 +0200
@@ -25,6 +25,7 @@
 CustomAccessMethodsCodeGenerator CustomAccessMethodsCodeGenerator jn:refactoring_custom 'Interface-Refactoring-Custom' 0
 CustomCodeGeneratorClassGenerator CustomCodeGeneratorClassGenerator jn:refactoring_custom 'Interface-Refactoring-Custom' 0
 CustomFooBarBazCodeGenerator CustomFooBarBazCodeGenerator jn:refactoring_custom 'Interface-Refactoring-Custom' 0
+CustomGetterMethodsCodeGenerator CustomGetterMethodsCodeGenerator jn:refactoring_custom '' 0
 CustomIsAbstractCodeGenerator CustomIsAbstractCodeGenerator jn:refactoring_custom 'Interface-Refactoring-Custom' 0
 CustomSubclassResponsibilityCodeGenerator CustomSubclassResponsibilityCodeGenerator jn:refactoring_custom 'Interface-Refactoring-Custom' 0
 CustomTestCaseCodeGenerator CustomTestCaseCodeGenerator jn:refactoring_custom '' 0
--- a/bc.mak	Sun May 11 15:48:51 2014 +0200
+++ b/bc.mak	Tue May 13 22:41:19 2014 +0200
@@ -95,6 +95,7 @@
 $(OUTDIR)CustomAccessMethodsCodeGenerator.$(O) CustomAccessMethodsCodeGenerator.$(H): CustomAccessMethodsCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\stx\libtool\CodeGeneratorTool.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)CustomCodeGeneratorClassGenerator.$(O) CustomCodeGeneratorClassGenerator.$(H): CustomCodeGeneratorClassGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\stx\libtool\CodeGeneratorTool.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)CustomFooBarBazCodeGenerator.$(O) CustomFooBarBazCodeGenerator.$(H): CustomFooBarBazCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\stx\libtool\CodeGeneratorTool.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)CustomGetterMethodsCodeGenerator.$(O) CustomGetterMethodsCodeGenerator.$(H): CustomGetterMethodsCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\stx\libtool\CodeGeneratorTool.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)CustomIsAbstractCodeGenerator.$(O) CustomIsAbstractCodeGenerator.$(H): CustomIsAbstractCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\stx\libtool\CodeGeneratorTool.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)CustomSubclassResponsibilityCodeGenerator.$(O) CustomSubclassResponsibilityCodeGenerator.$(H): CustomSubclassResponsibilityCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\stx\libtool\CodeGeneratorTool.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)CustomTestCaseCodeGenerator.$(O) CustomTestCaseCodeGenerator.$(H): CustomTestCaseCodeGenerator.st $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGenerator.$(H) $(INCLUDE_TOP)\jn\refactoring_custom\CustomCodeGeneratorOrRefactoring.$(H) $(INCLUDE_TOP)\stx\libtool\CodeGeneratorTool.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
--- a/jn_refactoring_custom.st	Sun May 11 15:48:51 2014 +0200
+++ b/jn_refactoring_custom.st	Tue May 13 22:41:19 2014 +0200
@@ -94,6 +94,7 @@
         CustomAccessMethodsCodeGenerator
         CustomCodeGeneratorClassGenerator
         CustomFooBarBazCodeGenerator
+        CustomGetterMethodsCodeGenerator
         CustomIsAbstractCodeGenerator
         CustomSubclassResponsibilityCodeGenerator
         CustomTestCaseCodeGenerator
--- a/libInit.cc	Sun May 11 15:48:51 2014 +0200
+++ b/libInit.cc	Tue May 13 22:41:19 2014 +0200
@@ -44,6 +44,7 @@
 _CustomAccessMethodsCodeGenerator_Init(pass,__pRT__,snd);
 _CustomCodeGeneratorClassGenerator_Init(pass,__pRT__,snd);
 _CustomFooBarBazCodeGenerator_Init(pass,__pRT__,snd);
+_CustomGetterMethodsCodeGenerator_Init(pass,__pRT__,snd);
 _CustomIsAbstractCodeGenerator_Init(pass,__pRT__,snd);
 _CustomSubclassResponsibilityCodeGenerator_Init(pass,__pRT__,snd);
 _CustomTestCaseCodeGenerator_Init(pass,__pRT__,snd);
--- a/refactoring_custom.rc	Sun May 11 15:48:51 2014 +0200
+++ b/refactoring_custom.rc	Tue May 13 22:41:19 2014 +0200
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
       VALUE "ProductName", "ProductName\0"
       VALUE "ProductVersion", "6.2.3.1118\0"
-      VALUE "ProductDate", "Sun, 11 May 2014 13:44:02 GMT\0"
+      VALUE "ProductDate", "Tue, 13 May 2014 20:38:59 GMT\0"
     END
 
   END