xref: /Universal-ctags/Tmain/readtags-qualifier-regex.d/run.sh (revision 4f93262dbe6547358e5a034c964f0b27e9f92403)
1#!/bin/sh
2
3# Copyright: 2020 Masatake YAMATO
4# License: GPL-2
5
6READTAGS=$3
7
8. ../utils.sh
9
10#V="valgrind --leak-check=full -v"
11V=
12
13if ! [ -x "${READTAGS}" ]; then
14    skip "no readtags"
15fi
16
17if ! ( "${READTAGS}" -h | grep -q -e -Q ); then
18    skip "no qualifier function in readtags"
19fi
20
21echo '# case sensitive'
22${V} ${READTAGS} -t output.tags -Q '(and $signature (#/char,.*,char|int,.*,int/ $signature))' -en -l
23
24echo '# case insensitive: the pattern is lower case'
25${V} ${READTAGS} -t output.tags -Q '(and $signature (#/char,.*,char|int,.*,int/i $signature))' -en -l
26
27echo '# case insensitive: the pattern is upper case'
28${V} ${READTAGS} -t output.tags -Q '(and $signature (#/CHAR,.*,CHAR|INT,.*,INT/i $signature))' -en -l
29
30echo '# case sensitive (string->regexp)'
31${V} ${READTAGS} -t output.tags -Q '(or #f #f (or #f (and $signature ((string->regexp "char,.*,char|int,.*,int") $signature)) #f) #f)' -en -l
32
33echo '# case sensitive (string->regexp :case-fold #f)'
34${V} ${READTAGS} -t output.tags -Q '(or #f #f (or #f (and $signature ((string->regexp "char,.*,char|int,.*,int" :case-fold #f) $signature)) #f) #f)' -en -l
35
36echo '# case sensitive (string->regexp :case-fold false)'
37${V} ${READTAGS} -t output.tags -Q '(or #f #f (or #f (and $signature ((string->regexp "char,.*,char|int,.*,int" :case-fold false) $signature)) #f) #f)' -en -l
38
39echo '# case insensitive: the pattern is lower case (string->regexp :case-fold #t)'
40${V} ${READTAGS} -t output.tags -Q '(or #f #f (or #f (and $signature ((string->regexp "char,.*,char|int,.*,int" :case-fold #t) $signature)) #f) #f)' -en -l
41
42echo '# case insensitive: the pattern is upper case (string->regexp :case-fold true)'
43${V} ${READTAGS} -t output.tags -Q '(or #f #f (or #f (and $signature ((string->regexp "CHAR,.*,CHAR|INT,.*,INT" :case-fold true) $signature)) #f) #f)' -en -l
44
45echo '# RAISING AN ERROR' 1>&2
46${V} ${READTAGS} -t output.tags -Q '(or #f #f (or #f (and $signature (#/[/ $signature)) #f) #f)' -en -l
47
48echo '# RAISING AN ERROR (string->regexp)' 1>&2
49${V} ${READTAGS} -t output.tags -Q '(or #f #f (or #f (and $signature ((string->regexp "[") $signature)) #f) #f)' -en -l
50