From 3a7e6cb782594993e519ba7073b7f96edb88ea43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Granstr=C3=B6m?= Date: Wed, 15 May 2024 19:04:54 +0200 Subject: [PATCH 1/6] nvim_win_get_config() now actually returns a number --- test/spec/automated/postwin_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/spec/automated/postwin_spec.lua b/test/spec/automated/postwin_spec.lua index 34d44dc7..916d3c48 100644 --- a/test/spec/automated/postwin_spec.lua +++ b/test/spec/automated/postwin_spec.lua @@ -64,8 +64,8 @@ describe('post window', function() } local id = postwin.open() local cfg = vim.api.nvim_win_get_config(id) - assert.are.equal(3, cfg.row[true]) - assert.are.equal(3, cfg.col[true]) + assert.are.equal(3, cfg.row) + assert.are.equal(3, cfg.col) assert.are.equal(12, cfg.width) assert.are.equal(12, cfg.height) assert.are.equal('NW', cfg.anchor) From 47fb2abfae675c9acad9f3d48902c38a4310a43c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Granstr=C3=B6m?= Date: Fri, 13 Sep 2024 19:46:46 +0200 Subject: [PATCH 2/6] Bump nvim version --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8fb9c223..1547837a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,9 +16,9 @@ jobs: matrix: include: - os: ubuntu-latest - url: https://github.com/neovim/neovim/releases/download/v0.7.0/nvim-linux64.tar.gz + url: https://github.com/neovim/neovim/releases/download/v0.10.1/nvim-linux64.tar.gz - os: macos-latest - url: https://github.com/neovim/neovim/releases/download/v0.7.0/nvim-macos.tar.gz + url: https://github.com/neovim/neovim/releases/download/v0.10.1/nvim-macos.tar.gz steps: - uses: actions/checkout@v3 - name: Prepare From 9185145c68a607f0d8ea618ef1f5c97867d76d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Granstr=C3=B6m?= Date: Sat, 14 Sep 2024 14:15:33 +0200 Subject: [PATCH 3/6] Set correct cursor position in unit test --- test/spec/automated/map_spec.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/spec/automated/map_spec.lua b/test/spec/automated/map_spec.lua index ce0b0901..1ecbc3ae 100644 --- a/test/spec/automated/map_spec.lua +++ b/test/spec/automated/map_spec.lua @@ -35,7 +35,8 @@ describe('map', function() cb(lines) end end) - vim.api.nvim_buf_set_lines(0, -2, -1, false, { 'foo' }) + vim.api.nvim_win_set_cursor(0, {1, 0}) + vim.api.nvim_buf_set_lines(0, -2, -1, true, { 'foo' }) ret.fn() editor.on_send:restore() end) From 6fd6ae320b61c03131ea43483506fba56d12c60f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Granstr=C3=B6m?= Date: Sat, 14 Sep 2024 14:43:51 +0200 Subject: [PATCH 4/6] Always override get_plugin_root_dir() in automated tests --- test/spec/automated/install_spec.lua | 8 +++----- test/spec/automated/path_spec.lua | 18 +++++++----------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/test/spec/automated/install_spec.lua b/test/spec/automated/install_spec.lua index 67afaa88..d772fb1e 100644 --- a/test/spec/automated/install_spec.lua +++ b/test/spec/automated/install_spec.lua @@ -1,10 +1,8 @@ local install = require 'scnvim.install' -local is_ci = vim.loop.os_getenv 'SCNVIM_CI' -if is_ci then - require('scnvim.path').get_plugin_root_dir = function() - return vim.fn.expand '%:p:h:h' - end +-- override for unit test runner +require('scnvim.path').get_plugin_root_dir = function() + return vim.fn.expand '%:p:h:h' end describe('install', function() diff --git a/test/spec/automated/path_spec.lua b/test/spec/automated/path_spec.lua index 093156ca..6903f8a2 100644 --- a/test/spec/automated/path_spec.lua +++ b/test/spec/automated/path_spec.lua @@ -1,11 +1,9 @@ local path = require 'scnvim.path' - local eq = assert.are.same -local is_ci = vim.loop.os_getenv 'SCNVIM_CI' -if is_ci then - path.get_plugin_root_dir = function() - return vim.fn.expand '%:p:h:h' - end + +-- override for unit test runner +path.get_plugin_root_dir = function() + return vim.fn.expand '%:p:h:h' end describe('path', function() @@ -73,9 +71,7 @@ describe('path', function() assert.is_false(path.exists(destination)) end) - it('returns plugin root dir', function() - local root_dir = path.get_plugin_root_dir() - root_dir = string.match(root_dir, 'scnvim') - eq(root_dir, 'scnvim') - end) + -- TODO: Find another way to test this function + -- it('returns plugin root dir', function() + -- end) end) From e18f902e6f219b66863d3ef6d61c05264b5ab78d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Granstr=C3=B6m?= Date: Sat, 14 Sep 2024 14:45:22 +0200 Subject: [PATCH 5/6] Fix formatting --- test/spec/automated/map_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/spec/automated/map_spec.lua b/test/spec/automated/map_spec.lua index 1ecbc3ae..7ed13141 100644 --- a/test/spec/automated/map_spec.lua +++ b/test/spec/automated/map_spec.lua @@ -35,7 +35,7 @@ describe('map', function() cb(lines) end end) - vim.api.nvim_win_set_cursor(0, {1, 0}) + vim.api.nvim_win_set_cursor(0, { 1, 0 }) vim.api.nvim_buf_set_lines(0, -2, -1, true, { 'foo' }) ret.fn() editor.on_send:restore() From f0258b11e5343cb51ece961ef0d30b7245e8fd29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Granstr=C3=B6m?= Date: Sat, 14 Sep 2024 14:48:35 +0200 Subject: [PATCH 6/6] Update nvim URL for macOS --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1547837a..a492cd1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: - os: ubuntu-latest url: https://github.com/neovim/neovim/releases/download/v0.10.1/nvim-linux64.tar.gz - os: macos-latest - url: https://github.com/neovim/neovim/releases/download/v0.10.1/nvim-macos.tar.gz + url: https://github.com/neovim/neovim/releases/download/v0.10.1/nvim-macos-arm64.tar.gz steps: - uses: actions/checkout@v3 - name: Prepare