From 02b68b259e0fa93af0dcce91c1af1de016c16512 Mon Sep 17 00:00:00 2001 From: Jonathan Coates Date: Thu, 12 Jan 2023 22:26:39 +0000 Subject: [PATCH] Correctly track coverage for startup.lua too --- .../src/test/java/dan200/computercraft/core/LuaCoverage.java | 2 ++ projects/core/src/test/resources/test-rom/mcfly.lua | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/core/src/test/java/dan200/computercraft/core/LuaCoverage.java b/projects/core/src/test/java/dan200/computercraft/core/LuaCoverage.java index 91be65bef..e71af2c24 100644 --- a/projects/core/src/test/java/dan200/computercraft/core/LuaCoverage.java +++ b/projects/core/src/test/java/dan200/computercraft/core/LuaCoverage.java @@ -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 diff --git a/projects/core/src/test/resources/test-rom/mcfly.lua b/projects/core/src/test/resources/test-rom/mcfly.lua index cb666c677..ab4019102 100644 --- a/projects/core/src/test/resources/test-rom/mcfly.lua +++ b/projects/core/src/test/resources/test-rom/mcfly.lua @@ -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