Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,8 @@ jobs:
chmod +x nvim.appimage
mv nvim.appimage ./build/nvim
}
git clone https://github.com/MunifTanjim/nui.nvim ~/.local/share/nvim/site/pack/vendor/start/nui.nvim
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim
ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start

- name: Run tests
run: |
export PATH="${PWD}/build/:${PATH}"
make test
./scripts/test.sh
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ luac.out

# Vim tag files
tags

# Others
.testcache
49 changes: 49 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

set -euo pipefail

while [[ $# -gt 0 ]]; do
case "${1}" in
--clean)
shift
echo "[test] cleaning up environment"
rm -rf ./.testcache
echo "[test] envionment cleaned"
;;
*)
shift
;;
esac
done

function setup_environment() {
echo
echo "[test] setting up environment"
echo

local plugins_dir="./.testcache/site/pack/vendor/start"
if [[ ! -d "${plugins_dir}" ]]; then
mkdir -p "${plugins_dir}"
fi

if [[ ! -d "${plugins_dir}/nui.nvim" ]]; then
echo "[plugins] nui.nvim: installing..."
git clone https://github.com/MunifTanjim/nui.nvim "${plugins_dir}/nui.nvim"
echo "[plugins] nui.nvim: installed"
echo
fi

if [[ ! -d "${plugins_dir}/plenary.nvim" ]]; then
echo "[plugins] plenary.nvim: installing..."
git clone https://github.com/nvim-lua/plenary.nvim "${plugins_dir}/plenary.nvim"
echo "[plugins] plenary.nvim: installed"
echo
fi

echo "[test] environment ready"
echo
}

setup_environment

make test
6 changes: 5 additions & 1 deletion tests/init_follow_current_file.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
-- Need the absolute path as when doing the testing we will issue things like `tcd` to change directory
-- to where our temporary filesystem lives
local root_dir = vim.fn.fnamemodify(vim.trim(vim.fn.system("git rev-parse --show-toplevel")), ":p")

vim.opt.packpath:prepend(string.format("%s", root_dir .. ".testcache/site"))

vim.opt.rtp = {
vim.fn.fnamemodify(vim.trim(vim.fn.system("git rev-parse --show-toplevel")), ":p"),
root_dir,
vim.env.VIMRUNTIME,
}

Expand Down
6 changes: 5 additions & 1 deletion tests/mininit.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
-- Need the absolute path as when doing the testing we will issue things like `tcd` to change directory
-- to where our temporary filesystem lives
local root_dir = vim.fn.fnamemodify(vim.trim(vim.fn.system("git rev-parse --show-toplevel")), ":p")

vim.opt.packpath:prepend(string.format("%s", root_dir .. ".testcache/site"))

vim.opt.rtp = {
vim.fn.fnamemodify(vim.trim(vim.fn.system("git rev-parse --show-toplevel")), ":p"),
root_dir,
vim.env.VIMRUNTIME,
}

Expand Down