[PATCH] sunit: Fix TestCase new printString signals an exception

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] sunit: Fix TestCase new printString signals an exception

Holger Freyther
From: Holger Hans Peter Freyther <[hidden email]>

Use testSelector printString as this works when testSelector
is a String/Symbol or an UndefinedObject.

2012-08-03  Holger Hans Peter Freyther  <[hidden email]>

        * packages/sunit/SUnit.st: Use testSelector printString as
        the testSelector may be an UndefinedObject.
        * packages/sunit/SUnitTest.st: Add #testPrintString.
---
 packages/sunit/ChangeLog     |    6 ++++++
 packages/sunit/SUnit.st      |    2 +-
 packages/sunit/SUnitTests.st |    9 +++++++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/packages/sunit/ChangeLog b/packages/sunit/ChangeLog
index 8449214..56a52cf 100644
--- a/packages/sunit/ChangeLog
+++ b/packages/sunit/ChangeLog
@@ -1,3 +1,9 @@
+2012-08-03  Holger Hans Peter Freyther  <[hidden email]>
+
+ * packages/sunit/SUnit.st: Use testSelector printString as
+ the testSelector may be an UndefinedObject.
+ * packages/sunit/SUnitTest.st: Add #testPrintString.
+
 2010-12-04  Paolo Bonzini  <[hidden email]>
 
  * package.xml: Remove now superfluous <file> tags.
diff --git a/packages/sunit/SUnit.st b/packages/sunit/SUnit.st
index bb814f9..58b3ab0 100644
--- a/packages/sunit/SUnit.st
+++ b/packages/sunit/SUnit.st
@@ -1104,7 +1104,7 @@ When you are writing a test case method, send #assert: aBoolean when you want to
  aStream
     nextPutAll: self class printString;
     nextPutAll: '>>#';
-    nextPutAll: testSelector
+    nextPutAll: testSelector printString.
     ]
 ]
 
diff --git a/packages/sunit/SUnitTests.st b/packages/sunit/SUnitTests.st
index d1160a1..166ee89 100644
--- a/packages/sunit/SUnitTests.st
+++ b/packages/sunit/SUnitTests.st
@@ -276,6 +276,15 @@ if the tests are hard to write, something is probably wrong with the design".'>
     assert: aResult errorCount = anErrorCount
     ]
 
+    testPrintString [
+        <category: 'Testing'>
+        "Make sure that a new test can be printed"
+
+        self
+            shouldnt: [TestCase new printString] raise: Exception;
+            assert: TestCase new printString = 'TestCase>>#nil'.
+    ]
+
     isLogging [
  <category: 'Logging'>
  ^true
--
1.7.10.4


_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk