11 ["test-passed"] = function () |
11 ["test-passed"] = function () |
12 return "PASS"; |
12 return "PASS"; |
13 end; |
13 end; |
14 ["test-failed"] = function (data) |
14 ["test-failed"] = function (data) |
15 local error_text; |
15 local error_text; |
16 if data.error and data.error.type == "unexpected-stanza" then |
16 if data.reason and data.reason.type == "unexpected-stanza" then |
17 error_text = "Received unexpected stanza:\n\n"..pretty(data.error.data.stanza, 4); |
17 error_text = "Received unexpected stanza:\n\n"..pretty(data.reason.data.stanza, 4); |
18 if data.error.data.expected then |
18 if data.reason.data.expected then |
19 error_text = error_text.."\n\nExpected:\n\n"..pretty(data.error.data.expected, 4); |
19 error_text = error_text.."\n\nExpected:\n\n"..pretty(data.reason.data.expected, 4); |
20 end |
20 end |
21 else |
21 else |
22 error_text = tostring(data.error); |
22 error_text = tostring(data.reason); |
23 end |
23 end |
24 return "FAIL: "..error_text |
24 return lines({ |
|
25 "FAILED: "..data.name; |
|
26 ""; |
|
27 (error_text:gsub("\n", "\n ")); |
|
28 ""; |
|
29 }, 4); |
25 end; |
30 end; |
26 ["test-error"] = function (data) |
31 ["test-error"] = function (data) |
27 return "ERROR: "..tostring(data.error); |
32 return lines({ |
|
33 "ERROR: "..data.name; |
|
34 ""; |
|
35 (tostring(data.reason):gsub("\n", "\n ")); |
|
36 ""; |
|
37 }, 4); |
28 end; |
38 end; |
29 |
39 |
30 ["action"] = function (data) |
40 ["action"] = function (data) |
31 local action = data.action; |
41 local action = data.action; |
32 local obj_type = data.object_type; |
42 local obj_type = data.object_type; |