Skip to content

Commit

Permalink
Merge pull request #4074 from masatake/readtags-refactor-for-searchin…
Browse files Browse the repository at this point in the history
…g-multiple-tag-files

readtags: refactor for searching multiple tag files
  • Loading branch information
masatake authored Sep 14, 2024
2 parents 74aa396 + 97e2489 commit 40b5861
Show file tree
Hide file tree
Showing 16 changed files with 317 additions and 133 deletions.
2 changes: 1 addition & 1 deletion Tmain/common-prelude.d/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if ! [ -x "${OPTSCRIPT}" ]; then
skip "no optscript"
fi

rm -f ${BUILDDIR}/*.tmp
rm -f ${BUILDDIR}/*.{in,out}.tmp

for t in $(ls *.ps); do
i=${BUILDDIR}/${t}.in.tmp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
Empty file.
29 changes: 29 additions & 0 deletions Tmain/readtags-error-conflicting-actions.d/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

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

BUILDDIR=$2
READTAGS=$3
#V="valgrind --leak-check=full --track-origins=yes -v"
V=

. ../utils.sh

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

f=${BUILDDIR}/tmp-readtags-error-conflicting-actions-$$
rm -f "$f"

{
${READTAGS} --tag-file input.tags -l - main
} 2> "$f"

s=$?

sed 's|.*\(readtags[^:]*\):|readtags:|' < "$f" 1>&2
rm "$f"

exit $s
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
readtags: choose either an action: finding a tag or listing all
Empty file.
1 change: 1 addition & 0 deletions Tmain/readtags-error-no-action.d/exit-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
Empty file.
29 changes: 29 additions & 0 deletions Tmain/readtags-error-no-action.d/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

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

BUILDDIR=$2
READTAGS=$3
#V="valgrind --leak-check=full --track-origins=yes -v"
V=

. ../utils.sh

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

f=${BUILDDIR}/tmp-readtags-error-no-action-$$
rm -f "$f"

{
${READTAGS} -t input.tags
} 2> "$f"

s=$?

sed 's|.*\(readtags[^:]*\):|readtags:|' < "$f" 1>&2
rm "$f"

exit $s
1 change: 1 addition & 0 deletions Tmain/readtags-error-no-action.d/stderr-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
readtags: no action specified: specify one of NAME, -l or -D
Empty file.
1 change: 1 addition & 0 deletions Tmain/readtags-error-no-input.d/exit-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
32 changes: 32 additions & 0 deletions Tmain/readtags-error-no-input.d/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

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

BUILDDIR=$2
READTAGS=$3
#V="valgrind --leak-check=full --track-origins=yes -v"
V=

. ../utils.sh

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

f=${BUILDDIR}/tmp-readtags-error-no-input-$$
rm -f "$f"
{
: &&
${READTAGS} -t ./no-such-input.tags -l ||
${READTAGS} -t ./no-such-input.tags -D ||
${READTAGS} -t ./no-such-input.tags - main ||
${READTAGS} -t ./no-such-input.tags main
} 2> "$f"

s=$?

sed 's|.*\(readtags[^:]*\):|readtags:|' < "$f" 1>&2
rm "$f"

exit $s
4 changes: 4 additions & 0 deletions Tmain/readtags-error-no-input.d/stderr-expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
readtags: cannot open tag file: No such file or directory: ./no-such-input.tags
readtags: cannot open tag file: No such file or directory: ./no-such-input.tags
readtags: cannot open tag file: No such file or directory: ./no-such-input.tags
readtags: cannot open tag file: No such file or directory: ./no-such-input.tags
Empty file.
Loading

0 comments on commit 40b5861

Please sign in to comment.