From faf8f75a4f63ed8e352d23a55a9921b16e7374fd Mon Sep 17 00:00:00 2001 From: leafOfTree Date: Wed, 21 Oct 2026 14:03:35 +0000 Subject: [PATCH] Add shared test cases with vim-svelte-plugin Name cases for scenarios also in vim-svelte-plugin as shared-*, adding one for multiline tags. test/shared.sh lists shared cases in only one of the plugins, as a warning in a separate job on GitHub Actions. --- .github/workflows/test.yml | 8 +++++ .gitignore | 1 + README.md | 2 ++ ...l-indent.vim => shared-initial-indent.vim} | 0 ...l-indent.vue => shared-initial-indent.vue} | 0 .../{lang-attr.vim => shared-lang-attr.vim} | 0 .../{lang-attr.vue => shared-lang-attr.vue} | 0 test/cases/shared-multiline-tag.vim | 6 ++++ test/cases/shared-multiline-tag.vue | 20 +++++++++++++ ...ent-file.vim => shared-no-syntax-file.vim} | 0 ...ent-file.vue => shared-no-syntax-file.vue} | 0 ...th-zero.vim => shared-shiftwidth-zero.vim} | 0 ...th-zero.vue => shared-shiftwidth-zero.vue} | 0 ...ntax-merge.vim => shared-syntax-merge.vim} | 0 ...ntax-merge.vue => shared-syntax-merge.vue} | 0 test/cases/{undo.vim => shared-undo.vim} | 0 test/cases/{undo.vue => shared-undo.vue} | 0 test/shared.sh | 30 +++++++++++++++++++ 18 files changed, 67 insertions(+) rename test/cases/{initial-indent.vim => shared-initial-indent.vim} (100%) rename test/cases/{initial-indent.vue => shared-initial-indent.vue} (100%) rename test/cases/{lang-attr.vim => shared-lang-attr.vim} (100%) rename test/cases/{lang-attr.vue => shared-lang-attr.vue} (100%) create mode 100644 test/cases/shared-multiline-tag.vim create mode 100644 test/cases/shared-multiline-tag.vue rename test/cases/{no-syntax-indent-file.vim => shared-no-syntax-file.vim} (100%) rename test/cases/{no-syntax-indent-file.vue => shared-no-syntax-file.vue} (100%) rename test/cases/{shiftwidth-zero.vim => shared-shiftwidth-zero.vim} (100%) rename test/cases/{shiftwidth-zero.vue => shared-shiftwidth-zero.vue} (100%) rename test/cases/{syntax-merge.vim => shared-syntax-merge.vim} (100%) rename test/cases/{syntax-merge.vue => shared-syntax-merge.vue} (100%) rename test/cases/{undo.vim => shared-undo.vim} (100%) rename test/cases/{undo.vue => shared-undo.vue} (100%) create mode 100755 test/shared.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 70435b8..3ae4efc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,3 +26,11 @@ jobs: run: ./test/run.sh env: VUE_TEST_EDITORS: ${{ matrix.neovim && 'nvim' || 'vim' }} + + shared: + name: shared cases with vim-svelte-plugin + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check shared cases + run: ./test/shared.sh diff --git a/.gitignore b/.gitignore index 7c02170..d73609c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ test.vue .DS_STORE test/deps/ doc/tags +test/other/ diff --git a/README.md b/README.md index 4a77d49..336578e 100644 --- a/README.md +++ b/README.md @@ -233,6 +233,8 @@ Each case is a `.vue` or `.wpy` file in [test/cases](test/cases), with an option 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. +Cases named `shared-*` are for scenarios also in [vim-svelte-plugin][9], which handles blocks in the same way. `./test/shared.sh` lists shared cases in only one of them, as a warning on GitHub Actions, so a fix in one plugin can be checked in the other. + ## Acknowledgments & Refs - [mxw/vim-jsx][1] diff --git a/test/cases/initial-indent.vim b/test/cases/shared-initial-indent.vim similarity index 100% rename from test/cases/initial-indent.vim rename to test/cases/shared-initial-indent.vim diff --git a/test/cases/initial-indent.vue b/test/cases/shared-initial-indent.vue similarity index 100% rename from test/cases/initial-indent.vue rename to test/cases/shared-initial-indent.vue diff --git a/test/cases/lang-attr.vim b/test/cases/shared-lang-attr.vim similarity index 100% rename from test/cases/lang-attr.vim rename to test/cases/shared-lang-attr.vim diff --git a/test/cases/lang-attr.vue b/test/cases/shared-lang-attr.vue similarity index 100% rename from test/cases/lang-attr.vue rename to test/cases/shared-lang-attr.vue diff --git a/test/cases/shared-multiline-tag.vim b/test/cases/shared-multiline-tag.vim new file mode 100644 index 0000000..cb9d78d --- /dev/null +++ b/test/cases/shared-multiline-tag.vim @@ -0,0 +1,6 @@ +" Lines after a multiline start tag or empty tag ending with '>' or '/>' +let g:test_flatten = 1 + +function! Check() + call ExpectIndentEachLine() +endfunction diff --git a/test/cases/shared-multiline-tag.vue b/test/cases/shared-multiline-tag.vue new file mode 100644 index 0000000..b519135 --- /dev/null +++ b/test/cases/shared-multiline-tag.vue @@ -0,0 +1,20 @@ + diff --git a/test/cases/no-syntax-indent-file.vim b/test/cases/shared-no-syntax-file.vim similarity index 100% rename from test/cases/no-syntax-indent-file.vim rename to test/cases/shared-no-syntax-file.vim diff --git a/test/cases/no-syntax-indent-file.vue b/test/cases/shared-no-syntax-file.vue similarity index 100% rename from test/cases/no-syntax-indent-file.vue rename to test/cases/shared-no-syntax-file.vue diff --git a/test/cases/shiftwidth-zero.vim b/test/cases/shared-shiftwidth-zero.vim similarity index 100% rename from test/cases/shiftwidth-zero.vim rename to test/cases/shared-shiftwidth-zero.vim diff --git a/test/cases/shiftwidth-zero.vue b/test/cases/shared-shiftwidth-zero.vue similarity index 100% rename from test/cases/shiftwidth-zero.vue rename to test/cases/shared-shiftwidth-zero.vue diff --git a/test/cases/syntax-merge.vim b/test/cases/shared-syntax-merge.vim similarity index 100% rename from test/cases/syntax-merge.vim rename to test/cases/shared-syntax-merge.vim diff --git a/test/cases/syntax-merge.vue b/test/cases/shared-syntax-merge.vue similarity index 100% rename from test/cases/syntax-merge.vue rename to test/cases/shared-syntax-merge.vue diff --git a/test/cases/undo.vim b/test/cases/shared-undo.vim similarity index 100% rename from test/cases/undo.vim rename to test/cases/shared-undo.vim diff --git a/test/cases/undo.vue b/test/cases/shared-undo.vue similarity index 100% rename from test/cases/undo.vue rename to test/cases/shared-undo.vue diff --git a/test/shared.sh b/test/shared.sh new file mode 100755 index 0000000..290c42a --- /dev/null +++ b/test/shared.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# List shared-* test cases missing in either vim-svelte-plugin or +# vim-vue-plugin. Both plugins work in the same way for blocks, so a case for +# a scenario in one plugin should be in the other with the same name. Only +# warn, as the other plugin may be updated later +# ./test/shared.sh +cd "$(dirname "$0")/.." || exit 1 +other=vim-svelte-plugin + +dir=test/other/$other +rm -rf "$dir" +git clone -q --depth 1 "https://github.com/leafOfTree/$other" "$dir" || exit 0 + +list() { + ls "$1"/test/cases/shared-*.vim 2>/dev/null | sed 's#.*/##; s#\.vim$##' | sort +} +list . > test/other/mine +list "$dir" > test/other/theirs + +missing=0 +for name in $(comm -23 test/other/mine test/other/theirs); do + echo "::warning::$name is not in $other" + missing=1 +done +for name in $(comm -13 test/other/mine test/other/theirs); do + echo "::warning::$name in $other is not here" + missing=1 +done +[ $missing -eq 0 ] && echo "Shared cases are the same as $other" +exit 0