1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-26 07:03:22 +00:00

Correctly track coverage for startup.lua too

This commit is contained in:
Jonathan Coates 2023-01-12 22:26:39 +00:00
parent 28a55349a9
commit 02b68b259e
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
2 changed files with 3 additions and 3 deletions

View File

@ -26,6 +26,7 @@ class LuaCoverage {
private static final Path ROOT = new File("src/main/resources/data/computercraft/lua").toPath();
private static final Path BIOS = ROOT.resolve("bios.lua");
private static final Path APIS = ROOT.resolve("rom/apis");
private static final Path STARTUP = ROOT.resolve("rom/startup.lua");
private static final Path SHELL = ROOT.resolve("rom/programs/shell.lua");
private static final Path MULTISHELL = ROOT.resolve("rom/programs/advanced/multishell.lua");
private static final Path TREASURE = ROOT.resolve("treasure");
@ -56,6 +57,7 @@ void write(Writer out) throws IOException {
var possiblePaths = Stream.of(
coverage.remove("/" + full),
path.equals(BIOS) ? coverage.remove("bios.lua") : null,
path.equals(STARTUP) ? coverage.remove("startup.lua") : null,
path.equals(SHELL) ? coverage.remove("shell.lua") : null,
path.equals(MULTISHELL) ? coverage.remove("multishell.lua") : null,
path.startsWith(APIS) ? coverage.remove(path.getFileName().toString()) : null

View File

@ -518,7 +518,7 @@ local function before_each(body)
before_each_fns[n], before_each_fns.n = body, n
end
local native_co_create, native_loadfile = coroutine.create, loadfile
local native_loadfile = loadfile
local line_counts = {}
if cct_test then
local expect = require "cc.expect".expect
@ -717,8 +717,6 @@ end
term.setTextColour(colours.white) io.write(info .. "\n")
-- Restore hook stubs
debug.sethook(nil, "l")
coroutine.create = native_co_create
_G.loadfile = native_loadfile
if cct_test then cct_test.finish(line_counts) end