Skip to content

Commit

Permalink
Tmain: introduce echo2 helper function
Browse files Browse the repository at this point in the history
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
  • Loading branch information
masatake committed Feb 26, 2019
1 parent fbd9e4e commit cf3f2a5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
10 changes: 6 additions & 4 deletions Tmain/lregex-kind-letter.d/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@

CTAGS="$1 --quiet --options=NONE"

/bin/echo param: '|(.)|\1|^ => ignoring'
. ../utils.sh

echo2 param: '|(.)|\1|^ => ignoring'
${CTAGS} --langdef=x --regex-x='|(.)|\1|^' --list-kinds-full=x
# In this case, ctags ignores the substring after the last '|'.
# It is evaluated as flags.

/bin/echo param: '|(.)|\1|^| => warning'
echo2 param: '|(.)|\1|^| => warning'
${CTAGS} --langdef=x --regex-x='|(.)|\1|^|' --list-kinds-full=x
# In this case, ctags warns specifying a wrong kind letter '^'.

/bin/echo param: '|(.)|\1|, => ignoring'
echo2 param: '|(.)|\1|, => ignoring'
${CTAGS} --langdef=x --regex-x='|(.)|\1|,' --list-kinds-full=x
# In this case, ctags ignores the substring after the last '|'.
# It is evaluated as flags.

/bin/echo param: '|(.)|\1|,| => using the default letter and name'
echo2 param: '|(.)|\1|,| => using the default letter and name'
${CTAGS} --langdef=x --regex-x='|(.)|\1|,|' --list-kinds-full=x
# In this case, ctags recognizes a kind letter and name
# are not given; 'r' and "regex" are used as default values.
4 changes: 4 additions & 0 deletions Tmain/lregex-kind-letter.d/stderr-expected.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
param: |(.)|\1|^ => ignoring
param: |(.)|\1|^| => warning
ctags: Kind letter must be an alphabetical character: "^"
param: |(.)|\1|, => ignoring
param: |(.)|\1|,| => using the default letter and name
8 changes: 1 addition & 7 deletions Tmain/lregex-kind-name.d/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@

CTAGS="$1 --quiet --options=NONE"

echo2()
{
# use a external echo command here.
# built-in echo suppresses \1.
/bin/echo "$@"
/bin/echo "$@" 1>&2
}
. ../utils.sh

echo2 param: '|(.)|\1|x,name| => acceptable'
${CTAGS} --langdef=x --regex-x='|(.)|\1|x,name|' --list-kinds-full=x
Expand Down
8 changes: 8 additions & 0 deletions Tmain/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,11 @@ filter_by_column_index()
done
done
}

echo2()
{
# use a external echo command here.
# built-in echo suppresses \1.
/bin/echo "$@"
/bin/echo "$@" 1>&2
}

0 comments on commit cf3f2a5

Please sign in to comment.