diff options
author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-09-03 00:38:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-03 00:38:10 +0200 |
commit | f30844008bdd313b03a19486159f571a067e68b9 (patch) | |
tree | 4d540689c620784a11b7a2ad21f40da6e364774d /test/busted_runner.lua | |
parent | 4ea4d72af800c40511afd006ea202d008e653c3f (diff) | |
download | rneovim-f30844008bdd313b03a19486159f571a067e68b9.tar.gz rneovim-f30844008bdd313b03a19486159f571a067e68b9.tar.bz2 rneovim-f30844008bdd313b03a19486159f571a067e68b9.zip |
build: download busted from own neovim/deps repository
Downloading the necessary files all at once instead of doing dependency
handling with luarocks speeds up installation immensely. We speed up the
process even more by using luv as a replacement for the C modules in the
busted dependencies, which allows us to skip costly compilation times.
Co-authored-by: bfredl <bjorn.linse@gmail.com>
Diffstat (limited to 'test/busted_runner.lua')
-rw-r--r-- | test/busted_runner.lua | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/test/busted_runner.lua b/test/busted_runner.lua index d6864c6492..8176292bcf 100644 --- a/test/busted_runner.lua +++ b/test/busted_runner.lua @@ -4,4 +4,61 @@ local suffix = (platform and platform.sysname:lower():find'windows') and '.dll' package.path = deps_install_dir.."/share/lua/5.1/?.lua;"..deps_install_dir.."/share/lua/5.1/?/init.lua;"..package.path package.cpath = deps_install_dir.."/lib/lua/5.1/?"..suffix..";"..package.cpath; +local uv = vim.uv + +local system = {} +package.loaded['system.core'] = system +function system.monotime() + uv.update_time() + return uv.now()*1e-3 +end +function system.gettime() + local sec, usec = uv.gettimeofday() + return sec+usec*1e-6 +end +function system.sleep(sec) + uv.sleep(sec*1e3) +end + +local term = {} +package.loaded['term.core'] = term +function term.isatty(_) + return uv.guess_handle(1) == 'tty' +end + +local lfs = {} +package.loaded['lfs'] = lfs + +function lfs.attributes(path, attr) + if attr == 'mode' then + local stat = uv.fs_stat(path) + return stat and stat.type or '' + else + error('not implemented') + end +end + +function lfs.currentdir() + return uv.cwd() +end + +function lfs.chdir(dir) + local status, err = pcall(uv.chdir, dir) + if status then + return true + else + return nil, err + end +end + +function lfs.dir(path) + local fs = uv.fs_scandir(path) + return function() + if not fs then + return + end + return uv.fs_scandir_next(fs) + end +end + require 'busted.runner'({ standalone = false }) |