Skip to content

Commit 40ba4a4

Browse files
committed
specs: update
1 parent 46d0273 commit 40ba4a4

File tree

14 files changed

+71
-348
lines changed

14 files changed

+71
-348
lines changed

.busted

Lines changed: 0 additions & 15 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.todo.md
2+
.tests

Makefile

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
set_lua_paths = eval $$(luarocks path --lua-version 5.1 --bin)
2-
busted = $$(find /usr/local/lib/luarocks/*/busted/* -name busted)
3-
set_luals_path = PATH="$$PATH:/home/yaro/.local/share/nvim/mason/bin/lua-language-server"
4-
5-
test_unit = busted --run=unit
6-
test_nvim = nvim --headless -i NONE -n -u spec/minimal_init.lua -l $(busted) --run=unit
1+
test=nvim -l tests/minit.lua tests -o utfTerminal -Xoutput --color -v
2+
#--shuffle-tests
73

84
tag ?= wip
95
watch = '*.lua'
@@ -25,13 +21,13 @@ stylua:
2521
stylua --check lua scripts spec
2622

2723
test:
28-
@$(set_lua_paths); $(test_unit)
24+
@$(test)
2925

3026
watch:
31-
@$(set_lua_paths); while sleep 0.1; do find . -name $(watch) | entr -d -c $(test_unit); done
27+
@while sleep 0.1; do find . -name $(watch) | entr -d -c $(test); done
3228

3329
watch_tag:
34-
@$(set_lua_paths); while sleep 0.1; do find . -name $(watch) | entr -d -c $(test_unit) --tags=$(tag); done
30+
@while sleep 0.1; do find . -name $(watch) | entr -d -c $(test) --tags=$(tag); done
3531

3632
test_nvim:
3733
@$(test_nvim) spec/unit

lua/lua-console/utils.lua

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,14 +359,18 @@ local function strip_local(lines)
359359
local ts = vim.treesitter
360360
local ret = {}
361361

362-
local start_row = vim.fn.line('.') - 1 - #lines
362+
local start_row = math.max(0, vim.fn.line('.') - 1 - #lines)
363363

364364
for i, line in ipairs(lines) do
365-
local col = line:find('^%s*local%s+')
365+
local cs, ce = 1, 1
366366

367-
if col then
368-
local node = ts.get_node { pos = { start_row + i, col } }
369-
line = node and node:parent():type() == 'chunk' and line:gsub('^%s*local%s+', '') or line
367+
while cs do
368+
cs, ce = line:find('local%s', ce)
369+
370+
if cs then
371+
local node = ts.get_node { pos = { start_row + i - 1, cs } }
372+
if node and node:parent():type() == 'chunk' then line = line:sub(1, cs - 1) .. line:sub(ce + 1) end
373+
end
370374
end
371375

372376
table.insert(ret, line)
@@ -470,6 +474,7 @@ local get_external_evaluator = function(buf, lang)
470474
local fun = opts.on_exit
471475
opts.on_exit = function(system_completed)
472476
vim.schedule(function()
477+
if not vim.api.nvim_buf_is_valid(buf) then return end
473478
vim.api.nvim_buf_del_extmark(buf, ns, 10)
474479
_ = fun and fun(system_completed)
475480
end)

spec/log.lua

Lines changed: 0 additions & 46 deletions
This file was deleted.

spec/minimal_init.lua

Lines changed: 0 additions & 2 deletions
This file was deleted.

spec/nvim-shim.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

spec/utfTerminal.lua

Lines changed: 0 additions & 250 deletions
This file was deleted.

0 commit comments

Comments
 (0)