scansion/console.lua

changeset 146
885fa9f5929d
parent 145
df4faaa2d36f
child 148
e2c85e095a4c
--- a/scansion/console.lua	Wed Sep 12 10:57:23 2018 +0100
+++ b/scansion/console.lua	Wed Sep 12 10:58:46 2018 +0100
@@ -13,18 +13,28 @@
 	end;
 	["test-failed"] = function (data)
 		local error_text;
-		if data.error and data.error.type == "unexpected-stanza" then
-			error_text = "Received unexpected stanza:\n\n"..pretty(data.error.data.stanza, 4);
-			if data.error.data.expected then
-				error_text = error_text.."\n\nExpected:\n\n"..pretty(data.error.data.expected, 4);
+		if data.reason and data.reason.type == "unexpected-stanza" then
+			error_text = "Received unexpected stanza:\n\n"..pretty(data.reason.data.stanza, 4);
+			if data.reason.data.expected then
+				error_text = error_text.."\n\nExpected:\n\n"..pretty(data.reason.data.expected, 4);
 			end
 		else
-			error_text = tostring(data.error);
+			error_text = tostring(data.reason);
 		end
-		return "FAIL: "..error_text
+		return lines({
+			"FAILED: "..data.name;
+			"";
+			(error_text:gsub("\n", "\n    "));
+			"";
+		}, 4);
 	end;
 	["test-error"] = function (data)
-		return "ERROR: "..tostring(data.error);
+		return lines({
+			"ERROR: "..data.name;
+			"";
+			(tostring(data.reason):gsub("\n", "\n    "));
+			"";
+		}, 4);
 	end;
 
 	["action"] = function (data)

mercurial