From: Jean Privat Date: Sat, 11 Jun 2016 03:20:00 +0000 (-0400) Subject: nitunit: use `message` attribute in XML to store the error message. X-Git-Url: http://nitlanguage.org nitunit: use `message` attribute in XML to store the error message. Doing so make it visible by defaukt. The content is displayed as `stack trace` Signed-off-by: Jean Privat --- diff --git a/src/testing/testing_base.nit b/src/testing/testing_base.nit index a6acc79..592d5f0 100644 --- a/src/testing/testing_base.nit +++ b/src/testing/testing_base.nit @@ -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