From 7035125b2b26aa68fcfb7cda39377ac79926a0f9 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 8 Apr 2024 11:03:20 +0200 Subject: test: improve test conventions Work on https://github.com/neovim/neovim/issues/27004. --- test/functional/lua/highlight_spec.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'test/functional/lua/highlight_spec.lua') diff --git a/test/functional/lua/highlight_spec.lua b/test/functional/lua/highlight_spec.lua index 197f3139f3..dc80a1672a 100644 --- a/test/functional/lua/highlight_spec.lua +++ b/test/functional/lua/highlight_spec.lua @@ -1,11 +1,11 @@ -local helpers = require('test.functional.helpers')(after_each) -local exec_lua = helpers.exec_lua -local eq = helpers.eq -local neq = helpers.neq -local eval = helpers.eval -local command = helpers.command -local clear = helpers.clear -local api = helpers.api +local t = require('test.functional.testutil')(after_each) +local exec_lua = t.exec_lua +local eq = t.eq +local neq = t.neq +local eval = t.eval +local command = t.command +local clear = t.clear +local api = t.api describe('vim.highlight.on_yank', function() before_each(function() @@ -19,7 +19,7 @@ describe('vim.highlight.on_yank', function() vim.cmd('bwipeout!') ]]) vim.uv.sleep(10) - helpers.feed('') -- avoid hang if error message exists + t.feed('') -- avoid hang if error message exists eq('', eval('v:errmsg')) end) -- cgit From 81fc27124b9e1b375e0ce9605ae69c3c2a2d9222 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Tue, 9 Apr 2024 12:26:16 +0100 Subject: refactor(test): inject after_each differently --- test/functional/lua/highlight_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/functional/lua/highlight_spec.lua') diff --git a/test/functional/lua/highlight_spec.lua b/test/functional/lua/highlight_spec.lua index dc80a1672a..dc62fa978c 100644 --- a/test/functional/lua/highlight_spec.lua +++ b/test/functional/lua/highlight_spec.lua @@ -1,4 +1,4 @@ -local t = require('test.functional.testutil')(after_each) +local t = require('test.functional.testutil')() local exec_lua = t.exec_lua local eq = t.eq local neq = t.neq -- cgit From 052498ed42780a76daea589d063cd8947a894673 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sat, 20 Apr 2024 17:44:13 +0200 Subject: test: improve test conventions Specifically, functions that are run in the context of the test runner are put in module `test/testutil.lua` while the functions that are run in the context of the test session are put in `test/functional/testnvim.lua`. Closes https://github.com/neovim/neovim/issues/27004. --- test/functional/lua/highlight_spec.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'test/functional/lua/highlight_spec.lua') diff --git a/test/functional/lua/highlight_spec.lua b/test/functional/lua/highlight_spec.lua index dc62fa978c..d47afa6164 100644 --- a/test/functional/lua/highlight_spec.lua +++ b/test/functional/lua/highlight_spec.lua @@ -1,11 +1,13 @@ -local t = require('test.functional.testutil')() -local exec_lua = t.exec_lua +local t = require('test.testutil') +local n = require('test.functional.testnvim')() + +local exec_lua = n.exec_lua local eq = t.eq local neq = t.neq -local eval = t.eval -local command = t.command -local clear = t.clear -local api = t.api +local eval = n.eval +local command = n.command +local clear = n.clear +local api = n.api describe('vim.highlight.on_yank', function() before_each(function() @@ -19,7 +21,7 @@ describe('vim.highlight.on_yank', function() vim.cmd('bwipeout!') ]]) vim.uv.sleep(10) - t.feed('') -- avoid hang if error message exists + n.feed('') -- avoid hang if error message exists eq('', eval('v:errmsg')) end) -- cgit From 97c7646501d5cd6f57c57ce30acca89c5b8573ff Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 12 May 2024 23:12:25 +0200 Subject: refactor(api): nvim_win_xx_ns are EXPERIMENTAL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: The nvim_win_xx_ns function family introduced in ba0370b1d718d473d0ef51c35d88b98ba220082b needs more bake-time. Currently it's narrowly defined for windows, but other scopes ("buffer") and features are likely in the future. Solution: - Rename the API with double-underscore to mark it as EXPERIMENTAL. TODO/FUTURE: - Rename and change the signature to support more than just "window" scope, and for other flexibility. - Open question: we could choose either: - "store scopes on namespaces", or - "store namespaces on scopes (w:/b:/…)" --- test/functional/lua/highlight_spec.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/functional/lua/highlight_spec.lua') diff --git a/test/functional/lua/highlight_spec.lua b/test/functional/lua/highlight_spec.lua index d47afa6164..c9f2d0a47f 100644 --- a/test/functional/lua/highlight_spec.lua +++ b/test/functional/lua/highlight_spec.lua @@ -43,9 +43,9 @@ describe('vim.highlight.on_yank', function() vim.api.nvim_buf_set_mark(0,"]",1,1,{}) vim.highlight.on_yank({timeout = math.huge, on_macro = true, event = {operator = "y"}}) ]]) - neq({}, api.nvim_win_get_ns(0)) + neq({}, api.nvim__win_get_ns(0)) command('wincmd w') - eq({}, api.nvim_win_get_ns(0)) + eq({}, api.nvim__win_get_ns(0)) end) it('removes old highlight if new one is created before old one times out', function() @@ -55,7 +55,7 @@ describe('vim.highlight.on_yank', function() vim.api.nvim_buf_set_mark(0,"]",1,1,{}) vim.highlight.on_yank({timeout = math.huge, on_macro = true, event = {operator = "y"}}) ]]) - neq({}, api.nvim_win_get_ns(0)) + neq({}, api.nvim__win_get_ns(0)) command('wincmd w') exec_lua([[ vim.api.nvim_buf_set_mark(0,"[",1,1,{}) @@ -63,6 +63,6 @@ describe('vim.highlight.on_yank', function() vim.highlight.on_yank({timeout = math.huge, on_macro = true, event = {operator = "y"}}) ]]) command('wincmd w') - eq({}, api.nvim_win_get_ns(0)) + eq({}, api.nvim__win_get_ns(0)) end) end) -- cgit