CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator.st
changeset 636 a7f9fcc82017
parent 634 d77d9a7561be
child 646 8338755e1088
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator.st	Sat Aug 23 20:04:41 2014 +0200
@@ -0,0 +1,65 @@
+"{ Package: 'jn:refactoring_custom' }"
+
+CustomTestCaseCodeGenerator subclass:#CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Interface-Refactoring-Custom'
+!
+
+
+!CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator class methodsFor:'accessing-presentation'!
+
+description
+    ^ 'Generate CodeGeneratorOrRefactoringTestCase subclass for selected classes (code generators/refactorings)'
+
+    "Modified: / 23-08-2014 / 19:50:52 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+!
+
+label
+    ^ 'CodeGeneratorOrRefactoringTestCase class'
+
+    "Modified: / 23-08-2014 / 19:50:58 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator methodsFor:'executing'!
+
+buildForClass: aClass testClass: aTestClass
+    | source className |
+
+    aTestClass superclassName: 'CustomCodeGeneratorOrRefactoringTestCase'.
+    className := aClass theNonMetaClass name.
+
+    source := 'test_code_generated
+    | expectedSource |
+
+    expectedSource := ''instanceVariable
+    ^ instanceVariable''.
+
+    self executeGeneratorInContext: #classWithInstanceVariable.
+    self assertMethodSource: expectedSource atSelector: #instanceVariable'.
+
+    codeBuilder
+        class: aTestClass;
+
+        protocol: 'tests';
+        source: source;
+        createMethod;
+
+        protocol: 'accessing';
+        source: 'generatorOrRefactoring
+    ^ `className new';
+        replace: '`className' with: className asString;
+        createMethod
+
+    "Created: / 13-06-2014 / 09:27:15 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+    "Modified: / 23-08-2014 / 19:56:09 / Jakub Nesveda <nesvejak@fit.cvut.cz>"
+! !
+
+!CustomCodeGeneratorOrRefactoringTestCaseCodeGenerator class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+