-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tmain: add cases for testing parser specific fields with data types d…
…efined in optlib Signed-off-by: Masatake YAMATO <yamato@redhat.com>
- Loading branch information
Showing
12 changed files
with
157 additions
and
3 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
Tmain/parser-own-fields-for-foreign-lang-in-json.d/input.unknownx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
public func foo(n, m); | ||
protected func bar(n); | ||
private func baz(n,...); | ||
X:tagme@iamowner | ||
Y:iamowner2=tagme2 | ||
Z:tagme-z@iamowner-z | ||
eset:a | ||
enoset:b |
12 changes: 12 additions & 0 deletions
12
Tmain/parser-own-fields-for-foreign-lang-in-json.d/knownz.ctags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--langdef=knownz | ||
--kinddef-knownz=m,mark,makers | ||
|
||
--_fielddef-knownz=owner,the owner of the markers{datatype=str} | ||
|
||
--_fielddef-knownz=len,the length of owner string{datatype=int} | ||
--fields-knownz=+{len} | ||
--_fielddef-knownz=lenplus,the length of owner string + 1{datatype=int} | ||
--fields-knownz=+{lenplus} | ||
|
||
--_fielddef-knownz=exported,whether the marker is exported or not{datatype=bool} | ||
--fields-knownz=+{exported} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright: 2025 Masatake YAMATO | ||
# License: GPL-2 | ||
|
||
. ../utils.sh | ||
|
||
CTAGS=$1 | ||
|
||
V= | ||
# V=valgrind | ||
|
||
is_feature_available "${CTAGS}" json | ||
|
||
echo "# output: json" | ||
${V} ${CTAGS} --options=NONE --options=./knownz.ctags --sort=no --options=./unknownx.ctags \ | ||
--fields=+l \ | ||
--fields-unknownx=+'{protection}{signature}' \ | ||
--fields-knownz=+'{owner}' \ | ||
--output-format=json \ | ||
-o - input.unknownx |
1 change: 1 addition & 0 deletions
1
Tmain/parser-own-fields-for-foreign-lang-in-json.d/stderr-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ctags: Notice: No options will be read from files or environment |
10 changes: 10 additions & 0 deletions
10
Tmain/parser-own-fields-for-foreign-lang-in-json.d/stdout-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# output: json | ||
{"_type": "tag", "name": "foo", "path": "input.unknownx", "pattern": "/^public func foo(n, m);$/", "language": "unknownx", "kind": "func", "protection": "public ", "signature": "(n, m)"} | ||
{"_type": "tag", "name": "bar", "path": "input.unknownx", "pattern": "/^protected func bar(n);$/", "language": "unknownx", "kind": "func", "protection": "protected ", "signature": "(n)"} | ||
{"_type": "tag", "name": "baz", "path": "input.unknownx", "pattern": "/^private func baz(n,...);$/", "language": "unknownx", "kind": "func", "protection": "private ", "signature": "(n,...)"} | ||
{"_type": "tag", "name": "tagme", "path": "input.unknownx", "pattern": "/^X:tagme@iamowner$/", "language": "knownz", "kind": "mark", "owner": "iamowner"} | ||
{"_type": "tag", "name": "tagme2", "path": "input.unknownx", "pattern": "/^Y:iamowner2=tagme2$/", "language": "knownz", "kind": "mark", "owner": "iamowner2"} | ||
{"_type": "tag", "name": "tagme-z", "path": "input.unknownx", "pattern": "/^Z:tagme-z@iamowner-z$/", "language": "knownz", "kind": "mark", "owner": "iamowner-z", "len": 10, "lenplus": 11} | ||
{"_type": "tag", "name": "a", "path": "input.unknownx", "pattern": "/^eset:a$/", "language": "knownz", "kind": "mark", "exported": true} | ||
{"_type": "tag", "name": "b", "path": "input.unknownx", "pattern": "/^enoset:b$/", "language": "knownz", "kind": "mark"} | ||
{"_type": "tag", "name": "7_exported", "path": "input.unknownx", "pattern": "/^enoset:b$/", "language": "knownz", "kind": "mark"} |
39 changes: 39 additions & 0 deletions
39
Tmain/parser-own-fields-for-foreign-lang-in-json.d/unknownx.ctags
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--langdef=unknownx{_foreignLanguage=knownz} | ||
--kinddef-unknownx=f,func,functions | ||
--map-unknownx=+.unknownx | ||
|
||
--_fielddef-unknownx=protection,protections | ||
--_fielddef-unknownx=signature,signatures | ||
|
||
--_prelude-unknownx={{ | ||
/exported false def | ||
}} | ||
|
||
--regex-unknownx=/^((public|protected|private) +)?func ([^\(]+)\((.*)\)/\3/f/{_field=protection:\1}{_field=signature:(\4)} | ||
--regex-unknownx=/^X:([a-z]+)@([a-z]+)/\1/m/{_language=knownz}{_field=owner:\2} | ||
--regex-unknownx=/^Y:([a-z0-9]+)=([a-z0-9]+)/\2/m/{_field=owner:\1}{_language=knownz} | ||
--regex-unknownx=/^Z:([-a-z]+)@([-a-z]+)/\1/m/{_language=knownz}{{ | ||
. \2 knownz.owner: | ||
. :knownz.owner { | ||
. exch length knownz.len: | ||
} if | ||
. :knownz.len { | ||
1 add | ||
. exch knownz.lenplus: | ||
} if | ||
}} | ||
|
||
--regex-unknownx=/^eset:([-a-z]+)/\1/m/{_language=knownz}{{ | ||
/exported . def | ||
. true knownz.exported: | ||
}} | ||
|
||
--regex-unknownx=/^enoset:([-a-z]+)/\1/m/{_language=knownz}{{ | ||
. false knownz.exported: | ||
exported :knownz.exported and { | ||
mark exported 0 string cvs (_exported) _buildstring | ||
/knownz | ||
/mark | ||
1@ _foreigntag _commit pop | ||
} if | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
--langdef=knownz | ||
--kinddef-knownz=m,mark,makers | ||
|
||
--_fielddef-knownz=owner,the owner of the markers | ||
--_fielddef-knownz=owner,the owner of the markers{datatype=str} | ||
|
||
--_fielddef-knownz=len,the length of owner string{datatype=int} | ||
--fields-knownz=+{len} | ||
--_fielddef-knownz=lenplus,the length of owner string + 1{datatype=int} | ||
--fields-knownz=+{lenplus} | ||
|
||
--_fielddef-knownz=exported,whether the marker is exported or not{datatype=bool} | ||
--fields-knownz=+{exported} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
ctags: Notice: No options will be read from files or environment | ||
ctags: Notice: No options will be read from files or environment |
17 changes: 16 additions & 1 deletion
17
Tmain/parser-own-fields-for-foreign-lang.d/stdout-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,20 @@ | ||
# output: tags | ||
foo input.unknownx /^public func foo(n, m);$/;" f language:unknownx protection:public signature:(n, m) | ||
bar input.unknownx /^protected func bar(n);$/;" f language:unknownx protection:protected signature:(n) | ||
baz input.unknownx /^private func baz(n,...);$/;" f language:unknownx protection:private signature:(n,...) | ||
foo input.unknownx /^public func foo(n, m);$/;" f language:unknownx protection:public signature:(n, m) | ||
tagme input.unknownx /^X:tagme@iamowner$/;" m language:knownz owner:iamowner | ||
tagme2 input.unknownx /^Y:iamowner2=tagme2$/;" m language:knownz owner:iamowner2 | ||
tagme-z input.unknownx /^Z:tagme-z@iamowner-z$/;" m language:knownz owner:iamowner-z len:10 lenplus:11 | ||
a input.unknownx /^eset:a$/;" m language:knownz exported: | ||
b input.unknownx /^enoset:b$/;" m language:knownz | ||
7_exported input.unknownx /^enoset:b$/;" m language:knownz | ||
# output: xref | ||
foo unknownx / owner:,len:,lenplus:,exported:- / public (n, m) | ||
bar unknownx / owner:,len:,lenplus:,exported:- / protected (n) | ||
baz unknownx / owner:,len:,lenplus:,exported:- / private (n,...) | ||
tagme knownz / owner:iamowner,len:,lenplus:,exported:- / | ||
tagme2 knownz / owner:iamowner2,len:,lenplus:,exported:- / | ||
tagme-z knownz / owner:iamowner-z,len:10,lenplus:11,exported:- / | ||
a knownz / owner:,len:,lenplus:,exported:exported / | ||
b knownz / owner:,len:,lenplus:,exported:- / | ||
7_exported knownz / owner:,len:,lenplus:,exported:- / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters