Skip to content

Commit

Permalink
Tmain: add a case for testing filter function of readtags
Browse files Browse the repository at this point in the history
Signed-off-by: Masatake YAMATO <[email protected]>
  • Loading branch information
masatake committed Feb 11, 2016
1 parent fa3a0fc commit 0322755
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Tmain/readtags-qualifier.d/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# ./ctags --fields='*' --extra='*' -o output.tags base.py
#
class Foo:
def aq ():
pass
def aw ():
pass
def ae ():
pass
class A:
pass
class Bar (Foo):
def bq ():
pass
def bw ():
pass
class B:
pass

class Baz (Foo):
def bq ():
pass
def bw ():
pass
class C:
pass

1 change: 1 addition & 0 deletions Tmain/readtags-qualifier.d/exit-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
27 changes: 27 additions & 0 deletions Tmain/readtags-qualifier.d/output.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Universal Ctags Team //
!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/
!_TAG_PROGRAM_URL https://ctags.io/ /official site/
!_TAG_PROGRAM_VERSION 0.0.0 /bbd8fc2/
A base.py /^ class A:$/;" kind:class line:11 language:Python scope:class:Foo inherits: access:public
B base.py /^ class B:$/;" kind:class line:18 language:Python scope:class:Bar inherits: access:public
Bar base.py /^class Bar (Foo):$/;" kind:class line:13 language:Python inherits:Foo access:public
Bar.bq base.py /^ def bq ():$/;" kind:member line:14 language:Python scope:class:Bar access:public signature:()
Bar.bw base.py /^ def bw ():$/;" kind:member line:16 language:Python scope:class:Bar access:public signature:()
Baz base.py /^class Baz (Foo): $/;" kind:class line:21 language:Python inherits:Foo access:public
Baz.bq base.py /^ def bq ():$/;" kind:member line:22 language:Python scope:class:Baz access:public signature:()
Baz.bw base.py /^ def bw ():$/;" kind:member line:24 language:Python scope:class:Baz access:public signature:()
C base.py /^ class C:$/;" kind:class line:26 language:Python scope:class:Baz inherits: access:public
Foo base.py /^class Foo:$/;" kind:class line:4 language:Python inherits: access:public
Foo.ae base.py /^ def ae ():$/;" kind:member line:9 language:Python scope:class:Foo access:public signature:()
Foo.aq base.py /^ def aq ():$/;" kind:member line:5 language:Python scope:class:Foo access:public signature:()
Foo.aw base.py /^ def aw ():$/;" kind:member line:7 language:Python scope:class:Foo access:public signature:()
ae base.py /^ def ae ():$/;" kind:member line:9 language:Python scope:class:Foo access:public signature:()
aq base.py /^ def aq ():$/;" kind:member line:5 language:Python scope:class:Foo access:public signature:()
aw base.py /^ def aw ():$/;" kind:member line:7 language:Python scope:class:Foo access:public signature:()
base.py base.py 28;" kind:file line:28 language:Python
bq base.py /^ def bq ():$/;" kind:member line:14 language:Python scope:class:Bar access:public signature:()
bq base.py /^ def bq ():$/;" kind:member line:22 language:Python scope:class:Baz access:public signature:()
bw base.py /^ def bw ():$/;" kind:member line:16 language:Python scope:class:Bar access:public signature:()
bw base.py /^ def bw ():$/;" kind:member line:24 language:Python scope:class:Baz access:public signature:()
29 changes: 29 additions & 0 deletions Tmain/readtags-qualifier.d/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

# Copyright: 2016 Masatake YAMATO
# License: GPL-2

READTAGS=$4

#V="valgrind --leak-check=full -v"
V=

if ! [ -x "${READTAGS}" ]; then
echo "no readtags"
eixt 77
fi

if ! ( "${READTAGS}" -h | grep -q -e -Q ); then
echo "no qualifier function in readtags"
exit 77
fi

echo ';; (suffix? $name "q")' &&
${V} ${READTAGS} -e -t output.tags -Q '(suffix? $name "q")' -l &&
echo ';; (and (eq? $kind "member") (eq? "Baz" $scope-name))' &&
${V} ${READTAGS} -e -t output.tags -Q '(and (eq? $kind "member") (eq? "Baz" $scope-name))' -l &&
echo ';; (and (eq? $kind "member") (substr? $name "."))' &&
${V} ${READTAGS} -e -t output.tags -Q '(and (eq? $kind "member") (substr? $name "."))' -l &&
echo ';; (and (member "Foo" $inherits) (eq? $kind "class"))' &&
${V} ${READTAGS} -e -t output.tags -Q '(and (member "Foo" $inherits) (eq? $kind "class"))' -l &&
:
Empty file.
23 changes: 23 additions & 0 deletions Tmain/readtags-qualifier.d/stdout-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
;; (suffix? $name "q")
Bar.bq base.py /^ def bq ():$/;" kind:member language:Python scope:class:Bar access:public signature:()
Baz.bq base.py /^ def bq ():$/;" kind:member language:Python scope:class:Baz access:public signature:()
Foo.aq base.py /^ def aq ():$/;" kind:member language:Python scope:class:Foo access:public signature:()
aq base.py /^ def aq ():$/;" kind:member language:Python scope:class:Foo access:public signature:()
bq base.py /^ def bq ():$/;" kind:member language:Python scope:class:Bar access:public signature:()
bq base.py /^ def bq ():$/;" kind:member language:Python scope:class:Baz access:public signature:()
;; (and (eq? $kind "member") (eq? "Baz" $scope-name))
Baz.bq base.py /^ def bq ():$/;" kind:member language:Python scope:class:Baz access:public signature:()
Baz.bw base.py /^ def bw ():$/;" kind:member language:Python scope:class:Baz access:public signature:()
bq base.py /^ def bq ():$/;" kind:member language:Python scope:class:Baz access:public signature:()
bw base.py /^ def bw ():$/;" kind:member language:Python scope:class:Baz access:public signature:()
;; (and (eq? $kind "member") (substr? $name "."))
Bar.bq base.py /^ def bq ():$/;" kind:member language:Python scope:class:Bar access:public signature:()
Bar.bw base.py /^ def bw ():$/;" kind:member language:Python scope:class:Bar access:public signature:()
Baz.bq base.py /^ def bq ():$/;" kind:member language:Python scope:class:Baz access:public signature:()
Baz.bw base.py /^ def bw ():$/;" kind:member language:Python scope:class:Baz access:public signature:()
Foo.ae base.py /^ def ae ():$/;" kind:member language:Python scope:class:Foo access:public signature:()
Foo.aq base.py /^ def aq ():$/;" kind:member language:Python scope:class:Foo access:public signature:()
Foo.aw base.py /^ def aw ():$/;" kind:member language:Python scope:class:Foo access:public signature:()
;; (and (member "Foo" $inherits) (eq? $kind "class"))
Bar base.py /^class Bar (Foo):$/;" kind:class language:Python inherits:Foo access:public
Baz base.py /^class Baz (Foo): $/;" kind:class language:Python inherits:Foo access:public

0 comments on commit 0322755

Please sign in to comment.