in modules print() can be used instead of qa_block.out (override functionality). The output is copied to chatlog.

qa_block.out() removed
This commit is contained in:
Alexander Weber 2016-09-13 14:14:32 +02:00
parent 2f4a24545e
commit dfacc97a9b
2 changed files with 13 additions and 13 deletions

@ -78,14 +78,14 @@ for name, def in pairs(minetest.registered_items) do
local recipes_for_node = minetest.get_all_craft_recipes(name)
if recipes_for_node == nil then
if print_no_recipe then
qa_block.out(name, "no_recipe")
print(name, "no_recipe")
end
else
for kn, vn in ipairs(recipes_for_node) do
for ku, vu in ipairs(known_recipes) do
if vu.output ~= vn.output and
is_same_recipe(vu, vn) == true then
qa_block.out('same recipe', vu.output, vn.output)
print('same recipe', vu.output, vn.output)
-- print (dump(vu),dump(vn)) --debug
end
end

@ -1,31 +1,31 @@
print("initialize Starting QA Block")
qa_block = {}
function qa_block.out(...)
old_print = print
print = function(...)
local outsting = ""
local out
local x
for x, out in ipairs(arg) do
outsting = (outsting..tostring(out)..'\t')
end
print(outsting)
old_print(outsting)
minetest.chat_send_all(outsting)
end
local filepath = minetest.get_modpath("qa_block").."/checks/"
local defaultmodule = "same_recipe"
local function do_module( module )
qa_block.out("QA checks started")
print("QA checks started")
--- TODO: some selectoin of executed check
local file = filepath..module..".lua"
local f=io.open(file,"r")
if not f then
qa_block.out("file "..file.." not found")
print("file "..file.." not found")
else
io.close(f)
local compiled
@ -33,17 +33,17 @@ local function do_module( module )
local err
local compiled, err = loadfile(file)
if not compiled then
qa_block.out("syntax error in module file"..file)
qa_block.out(err)
print("syntax error in module file"..file)
print(err)
else
executed, err = pcall(compiled)
if not executed then
qa_block.out("runtime error appears")
qa_block.out(err)
print("runtime error appears")
print(err)
end
end
end
qa_block.out("QA checks finished")
print("QA checks finished")
end