From ef3da72eb2cb8e23056c4feb12de0513d6009a7c Mon Sep 17 00:00:00 2001 From: Liu-Cheng Xu Date: Wed, 17 Feb 2021 19:42:20 +0800 Subject: [PATCH 1/3] Add test for vista.vim Ref https://github.com/liuchengxu/vista.vim/issues/386#issuecomment-780075143 --- Tmain/client-vista-vim-fields-expectation.d/README.md | 2 ++ .../exit-expected.txt | 1 + Tmain/client-vista-vim-fields-expectation.d/run.sh | 11 +++++++++++ .../stderr-expected.txt | 0 .../stdout-expected.txt | 2 ++ Tmain/client-vista-vim-fields-expectation.d/test.vim | 5 +++++ 6 files changed, 21 insertions(+) create mode 100644 Tmain/client-vista-vim-fields-expectation.d/README.md create mode 100644 Tmain/client-vista-vim-fields-expectation.d/exit-expected.txt create mode 100644 Tmain/client-vista-vim-fields-expectation.d/run.sh create mode 100644 Tmain/client-vista-vim-fields-expectation.d/stderr-expected.txt create mode 100644 Tmain/client-vista-vim-fields-expectation.d/stdout-expected.txt create mode 100644 Tmain/client-vista-vim-fields-expectation.d/test.vim diff --git a/Tmain/client-vista-vim-fields-expectation.d/README.md b/Tmain/client-vista-vim-fields-expectation.d/README.md new file mode 100644 index 0000000000..bad4b81315 --- /dev/null +++ b/Tmain/client-vista-vim-fields-expectation.d/README.md @@ -0,0 +1,2 @@ +If your change breaks this test case, notify the change +to https://github.com/liuchengxu/vista.vim. diff --git a/Tmain/client-vista-vim-fields-expectation.d/exit-expected.txt b/Tmain/client-vista-vim-fields-expectation.d/exit-expected.txt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/Tmain/client-vista-vim-fields-expectation.d/exit-expected.txt @@ -0,0 +1 @@ +0 diff --git a/Tmain/client-vista-vim-fields-expectation.d/run.sh b/Tmain/client-vista-vim-fields-expectation.d/run.sh new file mode 100644 index 0000000000..6bbff2a8f7 --- /dev/null +++ b/Tmain/client-vista-vim-fields-expectation.d/run.sh @@ -0,0 +1,11 @@ +# Copyright: 2021 +# License: GPL-2 +#!/usr/bin/env bash + +CTAGS=$1 + +. ../utils.sh + +$CTAGS --format=2 --excmd=pattern --fields=+nksSaf --extras=+F --sort=no --append=no --extras= --language-force=vim --vim-kinds=acfvmn --output-format=json --fields=-PF -f- $(pwd)/test.vim + +exit $? diff --git a/Tmain/client-vista-vim-fields-expectation.d/stderr-expected.txt b/Tmain/client-vista-vim-fields-expectation.d/stderr-expected.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Tmain/client-vista-vim-fields-expectation.d/stdout-expected.txt b/Tmain/client-vista-vim-fields-expectation.d/stdout-expected.txt new file mode 100644 index 0000000000..8d30db0328 --- /dev/null +++ b/Tmain/client-vista-vim-fields-expectation.d/stdout-expected.txt @@ -0,0 +1,2 @@ +{"_type": "tag", "name": "s:cur_dir", "line": 1, "kind": "variable"} +{"_type": "tag", "name": "vista#FindItemsUnderDirectory", "line": 3, "signature": "(dir)", "kind": "function"} diff --git a/Tmain/client-vista-vim-fields-expectation.d/test.vim b/Tmain/client-vista-vim-fields-expectation.d/test.vim new file mode 100644 index 0000000000..3cdf93375a --- /dev/null +++ b/Tmain/client-vista-vim-fields-expectation.d/test.vim @@ -0,0 +1,5 @@ +let s:cur_dir = fnamemodify(resolve(expand(':p')), ':h') + +function! vista#FindItemsUnderDirectory(dir) abort + return map(split(globpath(a:dir, '*'), '\n'), 'fnamemodify(v:val, '':t:r'')') +endfunction From d70456071576964cca61b69c6ba716b57b955beb Mon Sep 17 00:00:00 2001 From: Liu-Cheng Xu Date: Wed, 17 Feb 2021 20:25:18 +0800 Subject: [PATCH 2/3] Apply code review --- Tmain/client-vista-vim-fields-expectation.d/run.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Tmain/client-vista-vim-fields-expectation.d/run.sh b/Tmain/client-vista-vim-fields-expectation.d/run.sh index 6bbff2a8f7..5d9f4e6acb 100644 --- a/Tmain/client-vista-vim-fields-expectation.d/run.sh +++ b/Tmain/client-vista-vim-fields-expectation.d/run.sh @@ -1,11 +1,12 @@ # Copyright: 2021 # License: GPL-2 -#!/usr/bin/env bash CTAGS=$1 . ../utils.sh -$CTAGS --format=2 --excmd=pattern --fields=+nksSaf --extras=+F --sort=no --append=no --extras= --language-force=vim --vim-kinds=acfvmn --output-format=json --fields=-PF -f- $(pwd)/test.vim +is_feature_available "${CTAGS}" json + +$CTAGS --format=2 --excmd=pattern --fields=+nksSaf --extras=+F --sort=no --append=no --extras= --language-force=vim --vim-kinds=acfvmn --output-format=json --fields=-PF -f- test.vim exit $? From 46cda222aee220652b3644a997f84b19fa051148 Mon Sep 17 00:00:00 2001 From: Liu-Cheng Xu Date: Wed, 17 Feb 2021 20:26:30 +0800 Subject: [PATCH 3/3] Update URL --- Tmain/client-vista-vim-fields-expectation.d/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tmain/client-vista-vim-fields-expectation.d/run.sh b/Tmain/client-vista-vim-fields-expectation.d/run.sh index 5d9f4e6acb..d70a2aab6a 100644 --- a/Tmain/client-vista-vim-fields-expectation.d/run.sh +++ b/Tmain/client-vista-vim-fields-expectation.d/run.sh @@ -1,4 +1,4 @@ -# Copyright: 2021 +# Copyright: 2021 # License: GPL-2 CTAGS=$1