main: Modify run_test_script() to take the actual script data

Tue, 11 Sep 2018 23:25:51 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Tue, 11 Sep 2018 23:25:51 +0100
changeset 136
2df38fd36b2b
parent 135
0c1887ee2059
child 137
091212cef52a

main: Modify run_test_script() to take the actual script data

This allows scripts to come from places other than files.

main.lua file | annotate | diff | comparison | revisions
--- a/main.lua	Tue Sep 11 23:24:55 2018 +0100
+++ b/main.lua	Tue Sep 11 23:25:51 2018 +0100
@@ -275,8 +275,8 @@
 	end
 end;
 
-local function run_test_script(script_name)
-	local script = parse_script(read_script(script_name))
+local function run_test_script(script_name, script_text)
+	local script = parse_script(script_text)
 	log_data("script", { title = script.title, summary = script.summary, tags = script.tags, filename = script_name });
 
 	local ok, result, err = pcall(main, log_data, script);
@@ -300,7 +300,8 @@
 
 assert(#files > 0, "No test script provided");
 for i = 1, #files do
-	local ret = run_test_script(files[i]);
+	local script_text = read_script(files[i]);
+	local ret = run_test_script(files[i], script_text);
 	if not result_tally[ret.status] then
 		result_tally[ret.status] = {};
 	end

mercurial