From ef3da72eb2cb8e23056c4feb12de0513d6009a7c Mon Sep 17 00:00:00 2001 From: Liu-Cheng Xu Date: Wed, 17 Feb 2021 19:42:20 +0800 Subject: [PATCH] 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