-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework test command to be more flexible
This reworks the test command to work better when switching between different nvim channels. Currently the .build/nvim dir needs to be deleted manually when switching to a different channel but now different channels are downloaded to separate directories. Additionally this adds support for specifying an individual file to run the tests for which improves the developer experience of working on tests.
- Loading branch information
1 parent
a3e195a
commit e50de0c
Showing
2 changed files
with
36 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,47 @@ | ||
prepare channel="stable": | ||
[macos] | ||
prepare-nvim channel: | ||
#!/usr/bin/env bash | ||
test -d .build/nvim || { | ||
mkdir -p ./.build/nvim | ||
os=$(uname) | ||
if [[ "$os" == "Darwin" ]]; then | ||
curl -L https://github.com/neovim/neovim/releases/download/{{ channel }}/nvim-macos.tar.gz > ./.build/nvim-macos.tar.gz | ||
xattr -c ./.build/nvim-macos.tar.gz | ||
tar xzf ./.build/nvim-macos.tar.gz -C ./.build/nvim --strip-components=1 | ||
rm ./.build/nvim-macos.tar.gz | ||
elif [[ "$os" == "Linux" ]]; then | ||
curl -L https://github.com/neovim/neovim/releases/download/{{ channel }}/nvim-linux64.tar.gz > ./.build/nvim-linux64.tar.gz | ||
tar xzf ./.build/nvim-linux64.tar.gz -C ./.build/nvim --strip-components=1 | ||
rm ./.build/nvim-linux64.tar.gz | ||
else | ||
echo "Unsupported operating system: $os" | ||
exit 1 | ||
fi | ||
NVIM_DIR=".build/nvim/{{ channel }}" | ||
test -d $NVIM_DIR || { | ||
mkdir -p $NVIM_DIR | ||
|
||
curl -L https://github.com/neovim/neovim/releases/download/{{ channel }}/nvim-macos.tar.gz > ./.build/nvim-macos.tar.gz | ||
xattr -c ./.build/nvim-macos.tar.gz | ||
tar xzf ./.build/nvim-macos.tar.gz -C $NVIM_DIR --strip-components=1 | ||
rm ./.build/nvim-macos.tar.gz | ||
} | ||
|
||
[linux] | ||
prepare-nvim channel: | ||
#!/usr/bin/env bash | ||
NVIM_DIR=".build/nvim/{{ channel }}" | ||
test -d $NVIM_DIR || { | ||
mkdir -p $NVIM_DIR | ||
|
||
curl -L https://github.com/neovim/neovim/releases/download/{{ channel }}/nvim-linux64.tar.gz > ./.build/nvim-linux64.tar.gz | ||
tar xzf ./.build/nvim-linux64.tar.gz -C $NVIM_DIR --strip-components=1 | ||
rm ./.build/nvim-linux64.tar.gz | ||
} | ||
|
||
prepare-dependencies: | ||
#!/usr/bin/env bash | ||
test -d .build/dependencies || { | ||
mkdir -p ./.build/dependencies | ||
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ./.build/dependencies/plenary.nvim | ||
git clone --depth 1 https://github.com/nvim-treesitter/nvim-treesitter ./.build/dependencies/nvim-treesitter | ||
} | ||
tests_dir := "tests/nvim-paredit/" | ||
prepare channel: (prepare-nvim channel) prepare-dependencies | ||
|
||
test channel="stable" file="": (prepare channel) | ||
#!/usr/bin/env bash | ||
NVIM_DIR=".build/nvim/{{ channel }}" | ||
test: prepare | ||
./.build/nvim/bin/nvim --version | ||
./.build/nvim/bin/nvim \ | ||
./$NVIM_DIR/bin/nvim --version | ||
./$NVIM_DIR/bin/nvim \ | ||
--headless \ | ||
--noplugin \ | ||
-u tests/init.lua \ | ||
-c "PlenaryBustedDirectory tests/nvim-paredit { minimal_init='tests/init.lua', sequential=true }" | ||
-c "PlenaryBustedDirectory tests/nvim-paredit/{{ file }} { minimal_init='tests/init.lua', sequential=true }" |