mirror of
https://github.com/lune-org/lune.git
synced 2024-12-12 13:00:37 +00:00
Improve net tests
This commit is contained in:
parent
58ce046394
commit
744b73db3d
1 changed files with 8 additions and 4 deletions
|
@ -1,19 +1,23 @@
|
|||
local util = {}
|
||||
|
||||
function util.pass(method, url, message: string)
|
||||
function util.pass(method, url, message)
|
||||
local response = net.request({
|
||||
method = method,
|
||||
url = url,
|
||||
})
|
||||
assert(response.ok, message)
|
||||
if not response.ok then
|
||||
error(string.format("%s failed!\nResponse: %s", message, stdio.format(response)))
|
||||
end
|
||||
end
|
||||
|
||||
function util.fail(method, url, message: string)
|
||||
function util.fail(method, url, message)
|
||||
local response = net.request({
|
||||
method = method,
|
||||
url = url,
|
||||
})
|
||||
assert(not response.ok, message)
|
||||
if not response.ok then
|
||||
error(string.format("%s passed!\nResponse: %s", message, stdio.format(response)))
|
||||
end
|
||||
end
|
||||
|
||||
return util
|
||||
|
|
Loading…
Reference in a new issue