From 9c716d1a7edd3bdacdd8ab800c3606cf8af495d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Harnes?= Date: Wed, 6 Dec 2023 19:32:13 +0100 Subject: [PATCH] ci: fix macos and windows tests --- .github/workflows/ci.yml | 17 +++++++++-------- tests/util_spec.lua | 10 ++++++++-- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a727e1..e1ba33c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,23 +7,24 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] + nvim_version: ["stable", "nightly"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 + - name: Install Neovim - shell: bash - run: | - mkdir -p /tmp/nvim - wget -q https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage -O /tmp/nvim/nvim.appimage - cd /tmp/nvim - chmod a+x ./nvim.appimage - ./nvim.appimage --appimage-extract - echo "/tmp/nvim/squashfs-root/usr/bin/" >> $GITHUB_PATH + uses: rhysd/action-setup-vim@v1 + with: + neovim: true + version: ${{ matrix.nvim_version }} + - name: Run Tests + shell: bash run: | nvim --version [ ! -d tests ] && exit 0 nvim --headless -u tests/init.lua -c "PlenaryBustedDirectory tests/ {minimal_init = 'tests/init.lua', sequential = true}" + docs: runs-on: ubuntu-latest needs: tests diff --git a/tests/util_spec.lua b/tests/util_spec.lua index 4d4225d..a209efa 100644 --- a/tests/util_spec.lua +++ b/tests/util_spec.lua @@ -2,7 +2,13 @@ local util = require("img-clip.util") describe("util", function() it("can get the directory path from the file path", function() - local dir_path = util.get_dir_path_from_filepath("/home/user/project/image.png") - assert.same("/home/user/project/", dir_path) + -- construct test input + local path_separator = package.config:sub(1, 1) + local test_path = "path" .. path_separator .. "to" .. path_separator .. "file.txt" + local expected_dir_path = "path" .. path_separator .. "to" .. path_separator + + -- check if the correct directory path is returned + local dir_path = util.get_dir_path_from_filepath(test_path) + assert.equals(expected_dir_path, dir_path) end) end)