Merge pull request #609 from MihailRis/add-network-tests

Add network tests
This commit is contained in:
MihailRis
2025-09-14 16:04:16 +03:00
committed by GitHub
7 changed files with 93 additions and 16 deletions
+3 -3
View File
@@ -13,9 +13,9 @@ end
function refresh()
document.list:clear()
local available = pack.get_available()
local infos = pack.get_info(available)
for _, name in ipairs(available) do
local allpacks = table.merge(pack.get_available(), pack.get_installed())
local infos = pack.get_info(allpacks)
for _, name in ipairs(allpacks) do
local info = infos[name]
local scripts_dir = info.path.."/scripts/app"
if not file.exists(scripts_dir) then
+10
View File
@@ -0,0 +1,10 @@
local this = {}
function this.equals(expected, fact)
assert(fact == expected, string.format(
"(fact == expected) assertion failed\n Expected: %s\n Fact: %s",
expected, fact
))
end
return this
+1
View File
@@ -23,4 +23,5 @@ function on_menu_setup()
menubg = gui.root.menubg
controller.resize_menu_bg()
menu.page = "main"
menu.visible = true
end
+22 -11
View File
@@ -79,13 +79,20 @@ local function complete_app_lib(app)
coroutine.yield()
end
function app.sleep_until(predicate, max_ticks)
function app.sleep_until(predicate, max_ticks, max_time)
max_ticks = max_ticks or 1e9
max_time = max_time or 1e9
local ticks = 0
while ticks < max_ticks and not predicate() do
local start_time = os.clock()
while ticks < max_ticks and
os.clock() - start_time < max_time
and not predicate() do
app.tick()
ticks = ticks + 1
end
if os.clock() - start_time >= max_time then
error("timeout")
end
if ticks == max_ticks then
error("max ticks exceed")
end
@@ -174,6 +181,7 @@ if enable_experimental then
require "core:internal/maths_inline"
end
asserts = require "core:internal/asserts"
events = require "core:internal/events"
function pack.unload(prefix)
@@ -531,15 +539,18 @@ function start_coroutine(chunk, name)
local co = coroutine.create(function()
local status, error = xpcall(chunk, function(err)
local fullmsg = "error: "..string.match(err, ": (.+)").."\n"..debug.traceback()
gui.alert(fullmsg, function()
if world.is_open() then
__vc_app.close_world()
else
__vc_app.reset_content()
menu:reset()
menu.page = "main"
end
end)
if hud then
gui.alert(fullmsg, function()
if world.is_open() then
__vc_app.close_world()
else
__vc_app.reset_content()
menu:reset()
menu.page = "main"
end
end)
end
return fullmsg
end)
if not status then