reports/Builder__TestReportFormat.st
branchjv
changeset 296 4c26321be573
parent 248 82f1ff8c96a6
child 303 e217bb7aacf4
--- a/reports/Builder__TestReportFormat.st	Mon Jan 18 09:39:21 2016 +0000
+++ b/reports/Builder__TestReportFormat.st	Mon Jan 18 09:41:22 2016 +0000
@@ -97,19 +97,24 @@
 
 writeContext: context on: s
 
-    |home mthd src|
+    |home mthd src vars args argAndVarNames |
     [
     context printOn: s.
     s cr.
     s nextPutAll:'receiver: '. context receiver printOn: s. s cr.
-    s nextPutAll:'selector: '. context selector printOn: s. s cr.
+    s nextPutAll:'selector: '. context selector storeOn: s. s cr.
+
+    args := context args.
+    vars := context vars.
+    argAndVarNames := context argAndVarNames.
     s nextPutAll:'args: '; cr.
-    context args keysAndValuesDo:[:idx :eachArg |
-        s nextPutAll:'  '. idx printOn: s. s nextPutAll:': '. eachArg printOn: s.s cr.
+
+    args keysAndValuesDo:[:idx :eachArg |
+        s nextPutAll:'  '. idx printOn: s leftPaddedTo:2 . s space. (argAndVarNames at: idx ifAbsent:['']) printOn: s paddedTo:12. s nextPutAll:': '. eachArg printOn: s.s cr.
     ].
     s nextPutAll:'vars: '; cr.
-    context vars keysAndValuesDo:[:idx :eachVar |
-        s nextPutAll:'  '. idx printOn: s. s nextPutAll:': '. 
+    vars keysAndValuesDo:[:idx :eachVar |
+        s nextPutAll:'  '. idx printOn: s leftPaddedTo:2. s space. (argAndVarNames at: idx + args size ifAbsent:['']) printOn: s paddedTo:12. s nextPutAll:': '. 
         eachVar isString ifTrue:[
             eachVar storeOn: s.
         ] ifFalse:[
@@ -117,11 +122,25 @@
         ].
         s cr.
     ].
+    home := context methodHome.
+    mthd := home method.  
+
+    s nextPutAll:'bytecode: '; cr.    
+    mthd notNil ifTrue:[ 
+        (mthd isJavaMethod and:[mthd class ~~ JavaNativeMethod]) ifFalse:[ 
+            Decompiler decompile: mthd to: s.
+        ] ifTrue:[ 
+            (Smalltalk at: #JavaByteCodeDisassembler) notNil ifTrue:[ 
+                (Smalltalk at: #JavaByteCodeDisassembler) diassemble: mthd to: s.
+            ] ifFalse:[ 
+                s nextPutAll: ' ** no JavaByteCodeDisassembler **'  
+            ].
+        ].
+    ].
+
+    s cr.
     s nextPutAll:'source: '; cr.    
-
     [
-    home := context methodHome.
-    mthd := home method.
     mthd isNil ifTrue:[
          s nextPutAll: '** no source **'. s cr. s cr.
         ^ self.
@@ -153,9 +172,14 @@
         s   cr;
             nextPutAll:'!!!!!!ERROR WHEN GETTING STACK TRACE!!!!!!'; cr;
             nextPutAll: ex description; cr
-    ]
+    ]. 
+
+    "
+    String streamContents:[ :s | Builder::TestReportFormat basicNew writeContext: thisContext on: s ]
+    "
 
     "Created: / 03-08-2011 / 14:53:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 18-01-2016 / 08:12:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 writeStackTrace:err of:aTestCase on: str
@@ -701,6 +725,11 @@
     ^ '$Header$'
 !
 
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+!
+
 version_SVN
     ^ '$Id$'
 ! !