aerial.nvim/run_tests.sh
Slotos 21e3358617
chores: update markdown expectations, regenerate ruby symbols, enable nvim-treesitter main testing (#323)
* chore: Fix markdown tests

Recent update to nvim-treesitter breaks aerial.nvim tests.
Specifically:
- nvim-treesitter/nvim-treesitter@96f55f3043
- MDeiml/tree-sitter-markdown@cd705f1591

Manually poking around, the behaviour remains the same

* chore: Regenerate ruby symbol snapshots

Prior version held a bunch of data written by hand. This commit updates
it to avoid false alarms when generating symbols for new or updated
queries.

Expectations are not changed, only the order of keys in individual
tables was updated.

* chore: Option to run tests on nvim-treesitter main

While nvim-treesitter is not a strict requirement for aerial.nvim, it
is used to install parsers and it updates nvim default language to
parser assignments with practical values. This commit adds an ability to
run tests against `main` branch by providing `--test-main` option to
`run_tests.sh`.

* chore: Add neorg parser config to main branch

Use C++14 compatible compiler when running tests with `--test-main`,
otherwise parser compilation will fail.
2023-11-09 21:17:09 -08:00

51 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
set -e
NVIM_TREESITTER_BRANCH='master'
for arg in "$@"; do
shift
case "$arg" in
'--update')
export UPDATE_SYMBOLS=1
if ! command -v jq >/dev/null; then
echo "jq is required for --update. Please install jq"
exit 1
fi
;;
'--test-main')
NVIM_TREESITTER_BRANCH='main'
;;
*)
set -- "$@" "$arg"
;;
esac
done
mkdir -p ".testenv/config/nvim"
mkdir -p ".testenv/data/nvim"
mkdir -p ".testenv/state/nvim"
mkdir -p ".testenv/run/nvim"
mkdir -p ".testenv/cache/nvim"
PLUGINS=".testenv/data/nvim/site/pack/plugins/start"
if [ ! -e "$PLUGINS/plenary.nvim" ]; then
git clone --depth=1 https://github.com/nvim-lua/plenary.nvim.git "$PLUGINS/plenary.nvim"
fi
if [ ! -e "$PLUGINS/nvim-treesitter" ]; then
git clone --depth=1 --no-single-branch https://github.com/nvim-treesitter/nvim-treesitter.git "$PLUGINS/nvim-treesitter"
fi
(cd "$PLUGINS/plenary.nvim" && git pull)
(cd "$PLUGINS/nvim-treesitter" && git checkout ${NVIM_TREESITTER_BRANCH} && git pull)
export XDG_CONFIG_HOME=".testenv/config"
export XDG_DATA_HOME=".testenv/data"
export XDG_STATE_HOME=".testenv/state"
export XDG_RUNTIME_DIR=".testenv/run"
export XDG_CACHE_HOME=".testenv/cache"
nvim --headless -u tests/minimal_init.lua \
-c "RunTests ${1-tests}"
echo "Success"