client: Error out when test fails, instead of directly calling verse.quit()

Sat, 19 Sep 2015 21:50:11 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 19 Sep 2015 21:50:11 +0100
changeset 25
9f8166238993
parent 24
3c572d238d9e
child 26
c32334d33438

client: Error out when test fails, instead of directly calling verse.quit()

scansion/objects/client.lua file | annotate | diff | comparison | revisions
--- a/scansion/objects/client.lua	Sat Sep 19 21:49:03 2015 +0100
+++ b/scansion/objects/client.lua	Sat Sep 19 21:50:11 2015 +0100
@@ -56,10 +56,10 @@
 		local expected_stanza = fill_vars(client.script, assert(parse_xml((table.concat(data):gsub("\t", "  ")))));
 		local function stanza_handler(received_stanza)
 			if not stanzacmp.stanzas_match(expected_stanza, received_stanza) then
-				verse.quit();
 				client.log("NOT IT!")
 				client.log("Expected: %s", expected_stanza);
 				client.log("Received: %s", received_stanza);
+				error("Received unexpected stanza");
 			else
 				client.log("YES! %s", expected_stanza)
 			end
@@ -69,6 +69,7 @@
 		verse.add_task(stanza_timeout, function ()
 			if not expected_stanza then return; end
 			client.log("TIMEOUT waiting for %s", expected_stanza)
+			error("Timed out waiting for stanza");
 		end);
 	end;
 

mercurial