2021-09-09 18:53:21 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2021-09-13 11:10:07 +02:00
|
|
|
export LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$HOME/.local/share/lunarvim"}"
|
|
|
|
|
|
|
|
export LVIM_TEST_ENV=true
|
|
|
|
|
2021-10-31 16:23:44 +01:00
|
|
|
# we should start with an empty configuration
|
|
|
|
TEST_BASE_DIR="$(mktemp -d)"
|
|
|
|
|
|
|
|
export LUNARVIM_CONFIG_DIR="$TEST_BASE_DIR"
|
|
|
|
export LUNARVIM_CACHE_DIR="$TEST_BASE_DIR"
|
2021-09-13 11:10:07 +02:00
|
|
|
|
|
|
|
lvim() {
|
2021-10-03 16:13:46 +02:00
|
|
|
nvim -u "$LUNARVIM_RUNTIME_DIR/lvim/tests/minimal_init.lua" --cmd "set runtimepath+=$LUNARVIM_RUNTIME_DIR/lvim" "$@"
|
2021-09-13 11:10:07 +02:00
|
|
|
}
|
|
|
|
|
2021-09-09 18:53:21 +02:00
|
|
|
if [ -n "$1" ]; then
|
2021-09-13 11:10:07 +02:00
|
|
|
lvim --headless -c "lua require('plenary.busted').run('$1')"
|
2021-09-09 18:53:21 +02:00
|
|
|
else
|
2022-01-02 14:53:01 +01:00
|
|
|
lvim --headless -c "PlenaryBustedDirectory tests/specs { minimal_init = './tests/minimal_init.lua' }"
|
2021-09-09 18:53:21 +02:00
|
|
|
fi
|
2021-10-31 16:23:44 +01:00
|
|
|
|
|
|
|
rm -rf "$TEST_BASE_DIR"
|