-
-
Notifications
You must be signed in to change notification settings - Fork 330
Expand file tree
/
Copy pathinit.lua
More file actions
64 lines (53 loc) · 1.6 KB
/
init.lua
File metadata and controls
64 lines (53 loc) · 1.6 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---@brief [[
--- NOTE: This API is still under construction.
--- It may change in the future :)
---@brief ]]
local lookups = {
uv = "plenary.async.uv_async",
util = "plenary.async.util",
lsp = "plenary.async.lsp",
api = "plenary.async.api",
tests = "plenary.async.tests",
control = "plenary.async.control",
}
---@class PlenaryAsync: PlenaryAsyncAsync
---@field api PlenaryAsyncApi
---@field control PlenaryAsyncControl
---@field lsp PlenaryAsyncLsp
---@field tests PlenaryAsyncTests
---@field util PlenaryAsyncUtil
---@field uv PlenaryAsyncUv
local exports = setmetatable(require "plenary.async.async", {
__index = function(t, k)
local require_path = lookups[k]
if not require_path then
return
end
local mod = require(require_path)
t[k] = mod
return mod
end,
})
exports.tests.add_globals = function()
a = exports
-- must prefix with a or stack overflow, plenary.test harness already added it
a.describe = exports.tests.describe
-- must prefix with a or stack overflow
a.it = exports.tests.it
a.pending = exports.tests.pending
a.before_each = exports.tests.before_each
a.after_each = exports.tests.after_each
end
exports.tests.add_to_env = function()
local env = getfenv(2)
env.a = exports
-- must prefix with a or stack overflow, plenary.test harness already added it
env.a.describe = exports.tests.describe
-- must prefix with a or stack overflow
env.a.it = exports.tests.it
env.a.pending = exports.tests.pending
env.a.before_each = exports.tests.before_each
env.a.after_each = exports.tests.after_each
setfenv(2, env)
end
return exports