diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2024-02-21 23:41:37 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-02-21 23:41:37 -0300 |
commit | 4f6ce6e622922466781f3c6181b277c283246ce1 (patch) | |
tree | b8ead4801340bd958fccbcb97c35cc7d463f2435 | |
parent | f4fda82fdef92e31cf9be6478793ee648eaea557 (diff) | |
download | luarocks-pre-quick-tests.tar.gz luarocks-pre-quick-tests.tar.bz2 luarocks-pre-quick-tests.zip |
defer initializationpre-quick-tests
-rw-r--r-- | spec/util/quick.lua | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/spec/util/quick.lua b/spec/util/quick.lua index 9c88b719..c8bfb61a 100644 --- a/spec/util/quick.lua +++ b/spec/util/quick.lua | |||
@@ -2,12 +2,22 @@ local quick = {} | |||
2 | 2 | ||
3 | local dir_sep = package.config:sub(1, 1) | 3 | local dir_sep = package.config:sub(1, 1) |
4 | 4 | ||
5 | local cfg = require("luarocks.core.cfg") | 5 | local cfg, dir, fs, versions |
6 | local dir = require("luarocks.dir") | 6 | local initialized = false |
7 | local fs = require("luarocks.fs") | 7 | |
8 | local versions = require("spec.util.versions") | 8 | local function initialize() |
9 | cfg.init() | 9 | if initialized then |
10 | fs.init() | 10 | return |
11 | end | ||
12 | initialized = true | ||
13 | |||
14 | cfg = require("luarocks.core.cfg") | ||
15 | dir = require("luarocks.dir") | ||
16 | fs = require("luarocks.fs") | ||
17 | versions = require("spec.util.versions") | ||
18 | cfg.init() | ||
19 | fs.init() | ||
20 | end | ||
11 | 21 | ||
12 | local function native_slash(pathname) | 22 | local function native_slash(pathname) |
13 | return (pathname:gsub("[/\\]", dir_sep)) | 23 | return (pathname:gsub("[/\\]", dir_sep)) |
@@ -31,6 +41,8 @@ local function parse(filename) | |||
31 | local input = assert(fd:read("*a")) | 41 | local input = assert(fd:read("*a")) |
32 | fd:close() | 42 | fd:close() |
33 | 43 | ||
44 | initialize() | ||
45 | |||
34 | local tests = {} | 46 | local tests = {} |
35 | 47 | ||
36 | local cur_line = 0 | 48 | local cur_line = 0 |