From cf3f2a59a1d72801e134dd4c54ecba1a7f3dce0f Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Sat, 30 Jun 2018 12:41:44 +0900 Subject: [PATCH] Tmain: introduce echo2 helper function Signed-off-by: Masatake YAMATO --- Tmain/lregex-kind-letter.d/run.sh | 10 ++++++---- Tmain/lregex-kind-letter.d/stderr-expected.txt | 4 ++++ Tmain/lregex-kind-name.d/run.sh | 8 +------- Tmain/utils.sh | 8 ++++++++ 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Tmain/lregex-kind-letter.d/run.sh b/Tmain/lregex-kind-letter.d/run.sh index eb4a8c57a7..b34a26f988 100644 --- a/Tmain/lregex-kind-letter.d/run.sh +++ b/Tmain/lregex-kind-letter.d/run.sh @@ -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. diff --git a/Tmain/lregex-kind-letter.d/stderr-expected.txt b/Tmain/lregex-kind-letter.d/stderr-expected.txt index f47069b672..d156ef9d3e 100644 --- a/Tmain/lregex-kind-letter.d/stderr-expected.txt +++ b/Tmain/lregex-kind-letter.d/stderr-expected.txt @@ -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 diff --git a/Tmain/lregex-kind-name.d/run.sh b/Tmain/lregex-kind-name.d/run.sh index c57f608e9b..edb9018cf5 100644 --- a/Tmain/lregex-kind-name.d/run.sh +++ b/Tmain/lregex-kind-name.d/run.sh @@ -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 diff --git a/Tmain/utils.sh b/Tmain/utils.sh index 0f61656079..aa9f672be9 100644 --- a/Tmain/utils.sh +++ b/Tmain/utils.sh @@ -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 +}