Skip to content

Commit

Permalink
Tmain: add a case verifying ctags provides fields vista.vim expects
Browse files Browse the repository at this point in the history
<REMOVE ME>
This is an example for a test case verifying ctags satisfies an expection of a client tool.

* See <https://docs.ctags.io/en/latest/tips.html#tmain-a-facility-for-testing-main-part> to
  write and run a test case for Tmain target.
* Use `Tmain: ` as the prefix of the header of the commit log.
* Put files composint a test case to Tmain/client-<the name of client>-<aspect of testing>.d/ .
* Put a README Tmain/client-<the name of client>-<aspect of testing>.d/ in addition to putting
  the standard Tmain test files like run.sh. The README is the message to developers of u-ctags.
* Don't include unessary white-spaces in README and run.sh.
</REMOVE ME>

<REMOVE ME: MY TODO>
I must write this to our docs.
</REMOVE ME: MY TODO>
  • Loading branch information
masatake committed Feb 16, 2021
1 parent 70677d3 commit a7fe9f2
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Tmain/client-vista-vim-fields-expectation.d/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
If your change breaks this test case, notify the change
to https://github.com/liuchengxu/vista.vim.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
27 changes: 27 additions & 0 deletions Tmain/client-vista-vim-fields-expectation.d/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright: 2021 <YOUR NAME HERE:Please put your ame>
# License: GPL-2

CTAGS=$1

. ../utils.sh

fields=nksSaf

char_expand()
{
if test -n "$1"; then
echo ${1:0:1} $(char_expand ${1:1})
fi
}

s=0
for x in $(char_expand nksSaf); do
if ${CTAGS} --quiet --options=NONE --fields=+$x --_fatal-warnings /dev/null; then

This comment has been minimized.

Copy link
@liuchengxu

liuchengxu Feb 17, 2021

To be honest, I don't quite understand this test. liuchengxu/vista.vim#386 is because --fields=nksSaf previously produces name field but after some commit the name field is missing, only with --fields=+nksSaf the name field gets back again. We should ensure the fields of the output of --fields=nksSaf always stays the same.

This comment has been minimized.

Copy link
@masatake

masatake Feb 17, 2021

Author Owner

This test case is just an example illustrating how to write a test case.

This test case detects my trying to delete one of the fields nksSaf from ctags.
Of course, I will not introduce such a destructive change. Again, this is an example.

This comment has been minimized.

Copy link
@liuchengxu

liuchengxu Feb 17, 2021

Understood, just opened universal-ctags#2875, please take a look at it.

echo field $x is available.
else
echo field $x is not available.
s=1
fi
done

exit $s
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
field n is available.
field k is available.
field s is available.
field S is available.
field a is available.
field f is available.

0 comments on commit a7fe9f2

Please sign in to comment.