Skip to content

Commit 41587c4

Browse files
ignore self in coverage output
1 parent 3fed389 commit 41587c4

File tree

1 file changed

+35
-30
lines changed

1 file changed

+35
-30
lines changed

control.lua

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ local function stop()
4242
runningtestname = nil
4343
callAll("stop")
4444
end
45+
-- These mod names will remain in __modname__ format, rather than being translated
4546
local nopathmods = {level=true,base=true,core=true}
47+
-- These mods will be omitted from output entirely
48+
local ignoremods = {coverage = true}
4649
local function report()
4750
if runningtestname then stop() end
4851
local moddumps = callAll("dump")
@@ -51,40 +54,42 @@ local function report()
5154
for dumpname,dump in pairs(moddumps) do
5255
for testname,files in pairs(dump.tests) do
5356
for file,lines in pairs(files) do
54-
outlines[#outlines+1] = string.format("TN:%s [%s]\n",testname,dumpname)
5557
local modname,filename = file:match("__(.+)__/(.+)")
56-
if not modname then
57-
--startup tracing sometimes gives absolute path of the scenario script, turn it back into the usual form...
58-
filename = file:match("currently%-playing/(.+)")
59-
if filename then
60-
modname = "level"
58+
if not ignoremods[modname] then
59+
outlines[#outlines+1] = string.format("TN:%s [%s]\n",testname,dumpname)
60+
if not modname then
61+
--startup tracing sometimes gives absolute path of the scenario script, turn it back into the usual form...
62+
filename = file:match("currently%-playing/(.+)")
63+
if filename then
64+
modname = "level"
65+
end
6166
end
62-
end
63-
-- scenario scripts may provide hints to where they came from...
64-
if modname == "level" then
65-
local level = moddumps.level
66-
local levelpath = level and level.levelpath
67-
if levelpath then
68-
modname = levelpath.modname
69-
filename = levelpath.basepath .. filename
67+
-- scenario scripts may provide hints to where they came from...
68+
if modname == "level" then
69+
local level = moddumps.level
70+
local levelpath = level and level.levelpath
71+
if levelpath then
72+
modname = levelpath.modname
73+
filename = levelpath.basepath .. filename
74+
end
7075
end
76+
if nopathmods[modname] then
77+
-- we *still* can't identify level properly, so just give up...
78+
-- also, we can't create proper paths for core/base anyway
79+
outlines[#outlines+1] = string.format("SF:__%s__/%s\n",modname,filename)
80+
elseif modname == nil then
81+
--something totally unrecognized?
82+
outlines[#outlines+1] = string.format("SF:%s\n",file)
83+
else
84+
-- we found it! This will be a path relative to the `mods` directory.
85+
local modver = game.active_mods[modname]
86+
outlines[#outlines+1] = string.format("SF:./%s_%s/%s\n",modname,modver,filename)
87+
end
88+
for line,count in pairs(lines) do
89+
outlines[#outlines+1] = string.format("DA:%d,%d\n",line,count)
90+
end
91+
outlines[#outlines+1] = "end_of_record\n"
7192
end
72-
if nopathmods[modname] then
73-
-- we *still* can't identify level properly, so just give up...
74-
-- also, we can't create proper paths for core/base anyway
75-
outlines[#outlines+1] = string.format("SF:__%s__/%s\n",modname,filename)
76-
elseif modname == nil then
77-
--something totally unrecognized?
78-
outlines[#outlines+1] = string.format("SF:%s\n",file)
79-
else
80-
-- we found it! This will be a path relative to the `mods` directory.
81-
local modver = game.active_mods[modname]
82-
outlines[#outlines+1] = string.format("SF:./%s_%s/%s\n",modname,modver,filename)
83-
end
84-
for line,count in pairs(lines) do
85-
outlines[#outlines+1] = string.format("DA:%d,%d\n",line,count)
86-
end
87-
outlines[#outlines+1] = "end_of_record\n"
8893
end
8994
end
9095
end

0 commit comments

Comments
 (0)