Temporary commit - improved line coverage reporting.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 29 Jul 2013 20:26:28 +0200
changeset 202 730a466fbe35
parent 201 cc1dd618738d
child 203 297a4be47446
Temporary commit - improved line coverage reporting.
reports/Builder__ReportFormat.st
--- a/reports/Builder__ReportFormat.st	Mon Jul 29 20:26:20 2013 +0200
+++ b/reports/Builder__ReportFormat.st	Mon Jul 29 20:26:28 2013 +0200
@@ -164,6 +164,36 @@
     ^Report encode: aString
 
     "Created: / 03-08-2011 / 14:37:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+writeCDATA: string
+    | start stop |
+
+    start := 1. 
+    stop := start.
+    [ (stop := (string indexOf: $] startingAt: stop)) ~~ 0 ] whileTrue:[
+        ((stop < (string size - 1)) 
+            and:[(string at: stop + 1) == $]
+                and:[(string at: stop + 2) == $>]]) ifTrue:[
+                    " Okay, found CDATA end token "
+                    stream nextPutAll: string startingAt: start to: stop + 1.
+                    stream nextPutAll: ']]><!![CDATA[>'.
+                    start := stop := stop + 3.
+                ] ifFalse:[
+                    stop := stop + 1.
+                ].
+    ].
+    start < string size ifTrue:[
+        stream nextPutAll: string startingAt: start to: string size.        
+    ].
+
+    "
+    String streamContents:[:s | Builder::TestReportFormat::JUnit new report: nil stream: s; writeCDATA:'ABCD']
+    String streamContents:[:s | Builder::TestReportFormat::JUnit new report: nil stream: s; writeCDATA:']]]]']         
+    String streamContents:[:s | Builder::TestReportFormat::JUnit new report: nil stream: s; writeCDATA:'Some <[CDATA[ CDATA ]]> Some Text and stray terminator ]]> here']
+    "
+
+    "Created: / 05-07-2013 / 16:54:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !ReportFormat class methodsFor:'documentation'!
@@ -177,5 +207,6 @@
 !
 
 version_SVN
-    ^ '§Id: Builder__ReportFormat.st 262 2011-10-07 10:09:53Z vranyj1 §'
+    ^ '$Id$'
 ! !
+