TestCase.st
branchworking_v5_0
changeset 616 580add62d680
parent 614 3003097506c9
child 619 8ca8f9f83aea
--- a/TestCase.st	Thu Jul 17 15:28:02 2014 +0100
+++ b/TestCase.st	Tue Jan 27 09:51:19 2015 +0000
@@ -1,5 +1,7 @@
 "{ Package: 'stx:goodies/sunit' }"
 
+"{ NameSpace: Smalltalk }"
+
 TestAsserter subclass:#TestCase
 	instanceVariableNames:'testSelector'
 	classVariableNames:''
@@ -649,12 +651,54 @@
 !TestCase methodsFor:'running'!
 
 debug
-    [(self class selector: testSelector) runCase]
-        sunitEnsure: [TestResource resetResources: self resources].
+
+    | testCase outcome result wasProceeded|
+
+    [
+	result := TestResult stateError.
+	wasProceeded := false.
+
+	[
+	    (testCase := self class selector: testSelector) runCase.
+	    wasProceeded ifFalse:[
+		result := TestResult statePass.
+	    ]
+	] sunitOn:(TestResult failure) do: [:ex |
+	    ex creator == TestSkipped ifTrue:[
+		result := TestResult stateSkip.
+	    ] ifFalse:[
+		result := TestResult stateFail.
+	    ].
+	    "I want a debugger to open here..."
+	    "the only really portable dialect query..."
+	    ((Smalltalk respondsTo:#isSmalltalkX) and:[Smalltalk isSmalltalkX]) ifTrue:[
+		"/ debug
+		Debugger
+		    enter:ex raiseContext
+		    withMessage:(ex description)
+		    mayProceed:true.
+		wasProceeded := true.
+		ex proceed.
+	    ] ifFalse:[
+		"is there a portable way to open a debugger?"
+		self halt:(ex description).
+		wasProceeded := true.
+	    ].
+	].
+
+    ] sunitEnsure: [
+	" if proceeded in the debugger, we arrive here; "
+	" but still, this is not always a pass !! "
+	outcome := TestCaseOutcome new.
+	outcome testCase: testCase.
+	outcome result: result.
+	outcome remember.
+	TestResource resetResources: self resources
+    ].
 
     "Modified: / 07-07-2011 / 11:10:50 / jv"
     "Modified: / 07-07-2011 / 11:34:08 / Jan Vrany <jan.vrant@fit.cvut,cz>"
-    "Modified: / 09-07-2014 / 22:52:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 20-08-2011 / 14:15:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 debugAsFailure
@@ -878,6 +922,11 @@
     ^ '$Header: /cvs/stx/stx/goodies/sunit/TestCase.st,v 1.104 2014-03-21 17:23:32 stefan Exp $'
 !
 
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+!
+
 version_SVN
     ^ '$Id: TestCase.st,v 1.104 2014-03-21 17:23:32 stefan Exp $'
 ! !