SUnitTests2.st
changeset 439 c61cd2a45ee0
child 449 398e6eaf8de5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SUnitTests2.st	Mon Jan 16 21:46:11 2012 +0100
@@ -0,0 +1,91 @@
+"{ Package: 'stx:goodies/sunit' }"
+
+TestCase subclass:#SUnitTests2
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'SUnit-Smalltalk/X-Tests'
+!
+
+TestCase subclass:#TestCaseWithErrorInTearDown
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:SUnitTests2
+!
+
+!SUnitTests2 class methodsFor:'documentation'!
+
+documentation
+"
+    More tests for SUnit. Uses St/X private classes.
+
+    [author:]
+        Jan Vrany <jan.vrany@fit.cvut.cz>
+
+    [instance variables:]
+
+    [class variables:]
+
+    [see also:]
+
+"
+! !
+
+!SUnitTests2 methodsFor:'tests'!
+
+testErrorInTearDown
+
+    | result |
+
+    result := TestCaseWithErrorInTearDown buildSuite run.
+    self assert: result errors size == 2.
+
+    "Created: / 16-01-2012 / 20:07:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SUnitTests2::TestCaseWithErrorInTearDown class methodsFor:'testing'!
+
+isAbstract
+
+    "HACK: To prevent it being run by normal tools..."
+
+    (thisContext sender selector == #buildSuite) not.
+
+    "Created: / 16-01-2012 / 20:41:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SUnitTests2::TestCaseWithErrorInTearDown methodsFor:'running'!
+
+tearDown
+
+    10 perform: ' zork '
+
+    "Created: / 16-01-2012 / 19:55:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SUnitTests2::TestCaseWithErrorInTearDown methodsFor:'tests'!
+
+testFail
+
+    self assert: false
+
+    "Created: / 16-01-2012 / 19:54:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+testPass
+
+    self assert: true
+
+    "Created: / 16-01-2012 / 19:54:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SUnitTests2 class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/goodies/sunit/SUnitTests2.st,v 1.1 2012-01-16 20:46:11 vrany Exp $'
+!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/goodies/sunit/SUnitTests2.st,v 1.1 2012-01-16 20:46:11 vrany Exp $'
+! !