mirror of
https://github.com/leafOfTree/vim-vue-plugin.git
synced 2026-11-03 02:47:36 +08:00
Test with several Vim and Neovim versions and fixed deps
Run tests on GitHub Actions with Vim 8.2.0000, the latest Vim, Neovim 0.9.5 and the latest Neovim by rhysd/action-setup-vim. test/run.sh only uses the editors in $VUE_TEST_EDITORS if set, and fails if none runs. Clone the syntax plugins for tests at fixed commits, so changes there don't break tests unexpectedly.
This commit is contained in:
3 files changed
+44
-12
No files matched your search
@@ -6,10 +6,23 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
name: ${{ matrix.neovim && 'nvim' || 'vim' }} ${{ matrix.version }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- { neovim: false, version: v8.2.0000 }
|
||||||
|
- { neovim: false, version: stable }
|
||||||
|
- { neovim: true, version: v0.9.5 }
|
||||||
|
- { neovim: true, version: stable }
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install Vim and Neovim
|
- uses: rhysd/action-setup-vim@v1
|
||||||
run: sudo apt-get update && sudo apt-get install -y vim neovim
|
with:
|
||||||
|
neovim: ${{ matrix.neovim }}
|
||||||
|
version: ${{ matrix.version }}
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: ./test/run.sh
|
run: ./test/run.sh
|
||||||
|
env:
|
||||||
|
VUE_TEST_EDITORS: ${{ matrix.neovim && 'nvim' || 'vim' }}
|
||||||
@@ -215,6 +215,7 @@ Run tests with Vim and Neovim, whichever is installed
|
|||||||
```sh
|
```sh
|
||||||
./test/run.sh
|
./test/run.sh
|
||||||
./test/run.sh basic template # Only these cases
|
./test/run.sh basic template # Only these cases
|
||||||
|
VUE_TEST_EDITORS=nvim ./test/run.sh # Only Neovim
|
||||||
```
|
```
|
||||||
|
|
||||||
Each case is a `.vue` or `.wpy` file in [test/cases](test/cases), with an optional `.vim` file for the config and checks. A case fails if
|
Each case is a `.vue` or `.wpy` file in [test/cases](test/cases), with an optional `.vim` file for the config and checks. A case fails if
|
||||||
@@ -224,7 +225,7 @@ Each case is a `.vue` or `.wpy` file in [test/cases](test/cases), with an option
|
|||||||
- a check in `Check()` fails, such as syntax, `GetVueTag()`, `GetVueSyntax()` or fold level
|
- a check in `Check()` fails, such as syntax, `GetVueTag()`, `GetVueSyntax()` or fold level
|
||||||
- there is an error message
|
- there is an error message
|
||||||
|
|
||||||
Tests also run on GitHub Actions for each push and pull request.
|
Tests also run on GitHub Actions for each push and pull request, with Vim 8.2.0000, the latest Vim, Neovim 0.9.5 and the latest Neovim.
|
||||||
|
|
||||||
## Acknowledgments & Refs
|
## Acknowledgments & Refs
|
||||||
|
|
||||||
|
|||||||
+27
-9
@@ -1,17 +1,27 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Run all test cases, or the ones given as arguments, with vim and nvim if
|
# Run all test cases, or the ones given as arguments, with vim and nvim if
|
||||||
# they are installed. Vim runs in a pseudo terminal by `script`, as syntax
|
# they are installed, or only the ones in $VUE_TEST_EDITORS. Vim runs in a
|
||||||
# in Ex mode (-es) isn't the same as in a terminal.
|
# pseudo terminal by `script`, as syntax in Ex mode (-es) isn't the same as
|
||||||
|
# in a terminal.
|
||||||
# ./test/run.sh
|
# ./test/run.sh
|
||||||
# ./test/run.sh basic template
|
# ./test/run.sh basic template
|
||||||
|
# VUE_TEST_EDITORS=nvim ./test/run.sh
|
||||||
cd "$(dirname "$0")/.." || exit 1
|
cd "$(dirname "$0")/.." || exit 1
|
||||||
|
editors=${VUE_TEST_EDITORS:-vim nvim}
|
||||||
|
|
||||||
# Syntax plugins used by test/cases/example.vue
|
# Syntax plugins used by test/cases/example.vue, at fixed commits
|
||||||
mkdir -p test/deps
|
mkdir -p test/deps
|
||||||
for repo in digitaltoad/vim-pug kchmck/vim-coffee-script \
|
for dep in digitaltoad/vim-pug@ea39cd942cf3194230cf72bfb838901a5344d3b3 \
|
||||||
leafgarland/typescript-vim iloginow/vim-stylus; do
|
kchmck/vim-coffee-script@28421258a8dde5a50deafbfc19cd9873cacfaa79 \
|
||||||
|
leafgarland/typescript-vim@4740441db1e070ef8366c888c658000dd032e4cb \
|
||||||
|
iloginow/vim-stylus@0e457b09db55d3518703bb22e1555872c5c44b7a; do
|
||||||
|
repo=${dep%@*}
|
||||||
|
commit=${dep#*@}
|
||||||
dir=test/deps/${repo#*/}
|
dir=test/deps/${repo#*/}
|
||||||
[ -d "$dir" ] || git clone -q --depth 1 "https://github.com/$repo" "$dir"
|
[ -d "$dir" ] && continue
|
||||||
|
git init -q "$dir" &&
|
||||||
|
git -C "$dir" fetch -q --depth 1 "https://github.com/$repo" "$commit" &&
|
||||||
|
git -C "$dir" checkout -q FETCH_HEAD || exit 1
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
@@ -20,17 +30,24 @@ else
|
|||||||
cases=$(ls test/cases/*.vue test/cases/*.wpy 2>/dev/null | sed 's#.*/##; s#\.[a-z]*$##')
|
cases=$(ls test/cases/*.vue test/cases/*.wpy 2>/dev/null | sed 's#.*/##; s#\.[a-z]*$##')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
has_editor() {
|
||||||
|
case " $editors " in
|
||||||
|
*" $1 "*) command -v "$1" >/dev/null ;;
|
||||||
|
*) return 1 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
out=$(mktemp)
|
out=$(mktemp)
|
||||||
status=0
|
status=0
|
||||||
expected=0
|
expected=0
|
||||||
for name in $cases; do
|
for name in $cases; do
|
||||||
if command -v vim >/dev/null; then
|
if has_editor vim; then
|
||||||
expected=$((expected + 1))
|
expected=$((expected + 1))
|
||||||
VUE_TEST_CASE=$name VUE_TEST_OUT=$out timeout 60 script -qec \
|
VUE_TEST_CASE=$name VUE_TEST_OUT=$out timeout 60 script -qec \
|
||||||
'stty rows 40 cols 120; vim -N -u NONE -i NONE -S test/run.vim' \
|
'stty rows 40 cols 120; vim -N -u NONE -i NONE -S test/run.vim' \
|
||||||
/dev/null >/dev/null || status=1
|
/dev/null >/dev/null || status=1
|
||||||
fi
|
fi
|
||||||
if command -v nvim >/dev/null; then
|
if has_editor nvim; then
|
||||||
expected=$((expected + 1))
|
expected=$((expected + 1))
|
||||||
VUE_TEST_CASE=$name VUE_TEST_OUT=$out timeout 60 \
|
VUE_TEST_CASE=$name VUE_TEST_OUT=$out timeout 60 \
|
||||||
nvim --headless -u NONE -i NONE -S test/run.vim || status=1
|
nvim --headless -u NONE -i NONE -S test/run.vim || status=1
|
||||||
@@ -42,6 +59,7 @@ passed=$(grep -c '^ok' "$out")
|
|||||||
failed=$(grep -c '^FAIL' "$out")
|
failed=$(grep -c '^FAIL' "$out")
|
||||||
missing=$((expected - passed - failed))
|
missing=$((expected - passed - failed))
|
||||||
echo "$passed passed, $failed failed, $missing without result"
|
echo "$passed passed, $failed failed, $missing without result"
|
||||||
[ $failed -eq 0 ] && [ $missing -eq 0 ] || status=1
|
[ $expected -gt 0 ] || echo "No editor found in: $editors"
|
||||||
|
[ $expected -gt 0 ] && [ $failed -eq 0 ] && [ $missing -eq 0 ] || status=1
|
||||||
rm -f "$out"
|
rm -f "$out"
|
||||||
exit $status
|
exit $status
|
||||||
Reference in new issue
Block a user