extensions.st
changeset 273 404662b42ddf
parent 270 51c4ee46f5c0
child 275 29e5621cd306
--- a/extensions.st	Fri Aug 08 13:26:47 2014 +0100
+++ b/extensions.st	Mon Aug 11 14:37:44 2014 +0100
@@ -54,6 +54,40 @@
     "Created: / 27-11-2011 / 17:22:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!CustomTestCaseSetUpCodeGenerator methodsFor:'executing'!
+
+buildForClass: class
+    | source category superHasSetup current |
+
+    current := class.
+    superHasSetup := false.
+    [ superHasSetup not and:[ current isNil not  and:[current name ~~ #TestCase]] ] whileTrue:[
+        superHasSetup := current includesSelector: #setUp.
+        current := current superclass.
+    ].
+    (superHasSetup and:[ current name ~~ #TestCase ]) ifTrue:[ 
+        source := 'setUp
+    super setUp.
+
+    "Add your own code here..."
+'.
+        category := (current compiledMethodAt: #setUp) category.
+    ] ifFalse:[ 
+        source := 'setUp
+    "Add your own code here..."
+'.
+        category := (TestCase compiledMethodAt: #setUp) category.
+    ].
+
+    builder createMethod
+        class: class;
+        source: source;
+        category: category.
+
+    "Created: / 05-08-2014 / 14:17:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 11-08-2014 / 14:20:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !DoWhatIMeanSupport methodsFor:'code completion - smallsense'!
 
 smallSenseCodeCompletionForClass: classOrNilArg context: contextOrNil codeView: codeViewArg