From dc6ad97d91609c64e5900b7d1efcf01a85dd3867 Mon Sep 17 00:00:00 2001 From: Anatolii Sakhnik Date: Sat, 10 Aug 2024 21:19:05 +0300 Subject: [PATCH] Fix nvim-macos archive name --- test/10_generic_spec.lua | 27 ++++++++++++++++++++++++--- test/all.py | 2 ++ utils/testenv_darwin.py | 14 +++++++++----- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/test/10_generic_spec.lua b/test/10_generic_spec.lua index 23a8057..b62c543 100644 --- a/test/10_generic_spec.lua +++ b/test/10_generic_spec.lua @@ -31,7 +31,13 @@ describe("generic", function() local function check_signs(signs) -- different for different compilers - return vim.deep_equal(signs, {cur = 'test.cpp:17'}) or vim.deep_equal(signs, {cur = 'test.cpp:19'}) + local lines = {17, 19, 20} + for _, line in ipairs(lines) do + if vim.deep_equal(signs, {cur = 'test.cpp:' .. line}) then + return true + end + end + return false end assert.is_true(eng.wait_for(eng.get_signs, check_signs)) @@ -70,7 +76,7 @@ describe("generic", function() eng.feed('') assert.is_true(eng.wait_running(5000)) eng.feed(':GdbInterrupt\n') - if not utils.is_windows then + if utils.is_linux then assert.is_true(eng.wait_signs({cur = 'test.cpp:22'})) else -- Most likely to break in the kernel code @@ -180,7 +186,22 @@ describe("generic", function() eng.feed('n') assert.is_true(eng.wait_signs({cur = 'test.cpp:19'})) eng.feed('') - assert.is_true(eng.wait_signs({cur = 'test.cpp:17'})) + + if utils.is_darwin then + local function check_signs(signs) + -- different for different compilers + local lines = {17, 20} + for _, line in ipairs(lines) do + if vim.deep_equal(signs, {cur = 'test.cpp:' .. line}) then + return true + end + end + return false + end + assert.is_true(eng.wait_for(eng.get_signs, check_signs)) + else + assert.is_true(eng.wait_signs({cur = 'test.cpp:17'})) + end end) end) diff --git a/test/all.py b/test/all.py index 44a0371..f416135 100755 --- a/test/all.py +++ b/test/all.py @@ -36,6 +36,8 @@ Prerequisites() test_cmd = ["nvim", "-l", "run-tests.lua", ".", "--no-keep-going"] + # Use the following command to see neovim screen + # test_cmd = ["python", "nvim.py", "+luafile main.lua"] print(f"Run `{' '.join(test_cmd)}`") res = subprocess.run(test_cmd) if res.returncode != 0: diff --git a/utils/testenv_darwin.py b/utils/testenv_darwin.py index 734e7bd..82fb33d 100644 --- a/utils/testenv_darwin.py +++ b/utils/testenv_darwin.py @@ -1,4 +1,5 @@ import os +import platform import subprocess import urllib.request @@ -16,14 +17,17 @@ def __init__(self, url: str): subprocess.run('pip install --user six', shell=True, check=True) - urllib.request.urlretrieve(f"{url}/nvim-macos.tar.gz", - "nvim-macos.tar.gz") + # Macos may be running on arm64 + machine = platform.machine() + + urllib.request.urlretrieve(f"{url}/nvim-macos-{machine}.tar.gz", + f"nvim-macos-{machine}.tar.gz") subprocess.run( - r''' -tar -xf nvim-macos.tar.gz + f''' +tar -xf nvim-macos-{machine}.tar.gz cat >"$HOME/bin/nvim" <