nitunit: use `message` attribute in XML to store the error message.
authorJean Privat <jean@pryen.org>
Sat, 11 Jun 2016 03:20:00 +0000 (23:20 -0400)
committerJean Privat <jean@pryen.org>
Sat, 11 Jun 2016 03:20:00 +0000 (23:20 -0400)
Doing so make it visible by defaukt.
The content is displayed as `stack trace`

Signed-off-by: Jean Privat <jean@pryen.org>

src/testing/testing_base.nit

index a6acc79..592d5f0 100644 (file)
@@ -256,17 +256,22 @@ abstract class UnitTest
                tc.attr("classname", xml_classname)
                tc.attr("name", xml_name)
                tc.attr("time", real_time.to_s)
+
+               var output = self.raw_output
+               if output != null then output = output.trunc(8192).filter_nonprintable
                var error = self.error
                if error != null then
+                       var node
                        if was_exec then
-                               tc.open("error").append(error)
+                               node = tc.open("error").attr("message", error)
                        else
-                               tc.open("failure").append(error)
+                               node = tc.open("failure").attr("message", error)
                        end
-               end
-               var output = self.raw_output
-               if output != null then
-                       tc.open("system-err").append(output.trunc(8192).filter_nonprintable)
+                       if output != null then
+                               node.append(output)
+                       end
+               else if output != null then
+                       tc.open("system-err").append(output)
                end
                return tc
        end