Skip to content

Commit

Permalink
ci: fix macos and windows tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HakonHarnes committed Dec 6, 2023
1 parent e305f1a commit 9c716d1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions tests/util_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 9c716d1

Please sign in to comment.