Refactored to use TestResultOutcome
authorvrany
Tue, 16 Aug 2011 19:54:22 +0200
changeset 346 f64d6716acce
parent 345 abd1f2918992
child 347 1f72b6bb67a4
Refactored to use TestResultOutcome
TestRunInfo.st
--- a/TestRunInfo.st	Tue Aug 16 19:54:09 2011 +0200
+++ b/TestRunInfo.st	Tue Aug 16 19:54:22 2011 +0200
@@ -1,13 +1,13 @@
 "{ Package: 'stx:goodies/sunit' }"
 
-Object subclass:#TestRunInfo
-	instanceVariableNames:'startTime endTime exceptionDetail collectedStdout'
+Object subclass:#TestCaseOutcome
+	instanceVariableNames:'testCase result properties'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'SUnit-Base'
 !
 
-!TestRunInfo class methodsFor:'documentation'!
+!TestCaseOutcome class methodsFor:'documentation'!
 
 documentation
 "
@@ -18,46 +18,127 @@
 "
 ! !
 
-!TestRunInfo methodsFor:'accessing'!
+!TestCaseOutcome class methodsFor:'instance creation'!
+
+forCase: aTestCase
+
+    ^self new testCase: aTestCase; yourself
+
+    "Created: / 16-08-2011 / 15:24:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
 
-collectedStdout
-    ^ collectedStdout
+!TestCaseOutcome methodsFor:'accessing'!
+
+collectedOutput
+
+    ^self propertyAt: #collectedOutput
+
+    "Modified: / 16-08-2011 / 15:27:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 16-08-2011 / 18:19:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-collectedStdout:something
-    collectedStdout := something.
+collectedOutput: aString
+
+    ^self propertyAt: #collectedOutput put: aString
+
+    "Modified: / 16-08-2011 / 15:28:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 16-08-2011 / 18:19:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 endTime
-    ^ endTime
+
+    ^self propertyAt: #endTime
+
+    "Modified: / 16-08-2011 / 15:28:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-endTime:something
-    endTime := something.
+endTime: anObject
+
+    ^self propertyAt: #endTime put: anObject
+
+    "Modified: / 16-08-2011 / 15:28:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 exceptionDetail
-    ^ exceptionDetail
+
+    ^self propertyAt: #exceptionDetail
+
+    "Modified: / 16-08-2011 / 15:29:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+exceptionDetail: anObject
+
+    ^self propertyAt: #exceptionDetail put: anObject
+
+    "Modified: / 16-08-2011 / 15:29:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+propertyAt: aSymbol
+
+    self propertyAt: aSymbol ifAbsent: [nil]
+
+    "Created: / 16-08-2011 / 15:26:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-exceptionDetail:something
-    exceptionDetail := something.
+propertyAt: aSymbol ifAbsent: aBlock
+
+    properties isNil ifTrue: [^aBlock value].
+    ^properties at: aSymbol ifAbsent:aBlock.
+
+    "Created: / 16-08-2011 / 15:27:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+propertyAt: aSymbol put: anObject
+
+    properties isNil ifTrue: [properties := Dictionary new].
+    properties at: aSymbol put: anObject.
+
+    "Created: / 16-08-2011 / 15:28:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+result
+    ^ result
+!
+
+result:something
+    result := something.
+!
+
+selector
+
+    ^testCase selector
+
+    "Created: / 16-08-2011 / 15:38:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 startTime
-    ^ startTime
+
+    ^self propertyAt: #startTime
+
+    "Modified: / 16-08-2011 / 15:29:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+startTime: anObject
+
+    ^self propertyAt: #startTime put: anObject
+
+    "Modified: / 16-08-2011 / 15:29:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-startTime:something
-    startTime := something.
+testCase
+    ^ testCase
+!
+
+testCase:something
+    testCase := something.
 ! !
 
-!TestRunInfo class methodsFor:'documentation'!
+!TestCaseOutcome class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestRunInfo.st,v 1.2 2011-08-09 23:04:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestRunInfo.st,v 1.3 2011-08-16 17:54:22 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestRunInfo.st,v 1.2 2011-08-09 23:04:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/goodies/sunit/TestRunInfo.st,v 1.3 2011-08-16 17:54:22 vrany Exp $'
 ! !