-
-
Notifications
You must be signed in to change notification settings - Fork 218
Expand file tree
/
Copy pathhelpers.lua
More file actions
32 lines (24 loc) · 647 Bytes
/
Copy pathhelpers.lua
File metadata and controls
32 lines (24 loc) · 647 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
local assert = require("luassert")
local async = require("diffview.async")
local await, pawait = async.await, async.pawait
local M = {}
function M.eq(a, b)
if a == nil or b == nil then return assert.are.equal(a, b) end
return assert.are.same(a, b)
end
function M.neq(a, b)
if a == nil or b == nil then return assert.are_not.equal(a, b) end
return assert.are_not.same(a, b)
end
---@param test_func function
function M.async_test(test_func)
local afunc = async.void(test_func)
return function(...)
local ok, err = pawait(afunc(...))
await(async.scheduler())
if not ok then
error(err)
end
end
end
return M