diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-08-23 12:42:37 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-08-23 12:42:37 +0900 |
| commit | 07d294425a98ee5d1e22d03e2b24ae2c76e487c0 (patch) | |
| tree | a6818f0d64438c5fdb88b00a35d944f80c056213 /mac/.config/LunarVim/tests/lvim/helpers.lua | |
| parent | 6fc28cdb3529ca8ee864cb5c41674cb0a4af72a1 (diff) | |
updates
Diffstat (limited to 'mac/.config/LunarVim/tests/lvim/helpers.lua')
| -rw-r--r-- | mac/.config/LunarVim/tests/lvim/helpers.lua | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/mac/.config/LunarVim/tests/lvim/helpers.lua b/mac/.config/LunarVim/tests/lvim/helpers.lua new file mode 100644 index 0000000..83f7a1a --- /dev/null +++ b/mac/.config/LunarVim/tests/lvim/helpers.lua @@ -0,0 +1,32 @@ +local M = {} + +function M.search_file(file, args) + local Job = require "plenary.job" + local stderr = {} + local stdout, ret = Job:new({ + command = "grep", + args = { args, file }, + cwd = vim.loop.cwd(), + on_stderr = function(_, data) + table.insert(stderr, data) + end, + }):sync() + return ret, stdout, stderr +end + +function M.log_contains(query) + local logfile = require("lvim.core.log"):get_path() + local ret, stdout, stderr = M.search_file(logfile, query) + if ret == 0 then + return true + end + if not vim.tbl_isempty(stderr) then + error(vim.inspect(stderr)) + end + if not vim.tbl_isempty(stdout) then + error(vim.inspect(stdout)) + end + return false +end + +return M |
