* t/tagsub.sh: Rename ...
* t/etags.sh: ... like this, and extend greatly.
* t/ctags.sh: New test (vi-style ctags).
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test vi-style tags.
+
+required=ctags
+. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AC_SUBST([CC], [false])
+AM_CONDITIONAL([COND_FALSE], [false])
+AC_CONFIG_FILES([sub1/Makefile
+ sub3/Makefile
+ sub2/Makefile
+ sub2/subsub/Makefile])
+AC_OUTPUT
+END
+
+mkdir sub1 sub2 sub3 sub2/subsub
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub1 sub2 sub3
+test-ctags: ctags
+ test ! -f tags
+ cat sub1/tags
+ cat sub2/tags
+ cat sub2/subsub/tags
+ test ! -f sub3/tags
+ grep 'iguana\.c' sub1/tags
+ grep 'zap_zap' sub1/tags
+ grep 'main' sub1/tags
+ grep 'choke_me' sub1/tags && exit 1; :
+ grep 'subsub/foo\.h' sub2/tags
+ grep 'DUMMY_DUMMY' sub2/tags
+ grep 'bar\.f77' sub2/subsub/tags
+ grep 'foo\.cxx' sub2/subsub/tags
+ grep 'foo\.h' sub2/subsub/tags && exit 1; :
+check-local: test-ctags
+END
+
+cat > sub1/Makefile.am << 'END'
+if COND_FALSE
+bin_PROGRAMS = iguana
+endif
+END
+
+cat > sub1/iguana.c <<'END'
+int main (void) { return zap_zap (0); }
+
+int
+zap_zap (int x)
+{
+ return x + choke_me ();
+}
+END
+
+cat > sub2/Makefile.am << 'END'
+SUBDIRS = subsub .
+noinst_HEADERS = subsub/foo.h
+subsub/foo.h:
+ echo '#define DUMMY_DUMMY 0' >$@
+CLEANFILES = $(noinst_HEADERS)
+END
+
+cat > sub2/subsub/Makefile.am << 'END'
+TAGS_FILES =
+EXTRA_DIST = bar.f77
+TAGS_FILES += bar.f77
+nodist_noinst_DATA = foo.cxx
+TAGS_FILES += foo.cxx
+CLEANFILES = foo.cxx
+foo.cxx:
+ echo "int cxx_func (void) { return 0; }" >$@
+END
+
+cat > sub2/subsub/bar.f77 << 'END'
+ subroutine foobarbaz
+ return
+ end
+END
+
+# No file to tag here, deliberately.
+: > sub3/Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -i
+
+./configure
+$MAKE test-ctags
+$MAKE distcheck
+
+$MAKE distclean
+find . -name tags | grep . && exit 1
+
+:
--- /dev/null
+#! /bin/sh
+# Copyright (C) 1997-2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test to make sure tags and subdirs work correctly. Bug report by
+# François Pinard, and later by Akim Demaille.
+
+required=etags
+. ./defs || exit 1
+
+cat >> configure.ac << 'END'
+AC_SUBST([CC], [false])
+AM_CONDITIONAL([CONF_FALSE], [false])
+AC_CONFIG_FILES([sub1/Makefile])
+AC_CONFIG_FILES([sub2/Makefile])
+AC_CONFIG_FILES([sub2/subsub/Makefile])
+AC_CONFIG_FILES([sub3/Makefile])
+AC_OUTPUT
+END
+
+mkdir sub1 sub2 sub3 sub2/subsub
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub1 sub2 sub3
+test-tags: tags
+ cat sub1/TAGS
+ cat sub2/TAGS
+ cat sub2/subsub/TAGS
+ test ! -f sub3/TAGS
+ grep 'sub1/TAGS' TAGS
+ grep 'sub2/TAGS' TAGS
+ grep 'sub3/TAGS' TAGS && exit 1; :
+ grep 'iguana\.c' sub1/TAGS
+ grep 'subsub/TAGS' sub2/TAGS
+ grep 'subsub/foo\.h' sub2/TAGS
+ grep 'bar\.baz' sub2/subsub/TAGS
+ grep 'foo\.off' sub2/subsub/TAGS
+ grep 'foo\.h' sub2/subsub/TAGS && exit 1; :
+check-local: test-tags
+END
+
+cat > sub1/Makefile.am << 'END'
+if COND_FALSE
+bin_PROGRAMS = iguana
+endif
+END
+echo 'int main () { return choke_me (); }' > sub1/iguana.c
+
+cat > sub2/Makefile.am << 'END'
+SUBDIRS = subsub .
+noinst_HEADERS = subsub/foo.h
+subsub/foo.h:
+ echo dummy >$@
+CLEANFILES = $(noinst_HEADERS)
+END
+
+cat > sub2/subsub/Makefile.am << 'END'
+EXTRA_DIST = bar.baz
+nodist_noinst_DATA = foo.off
+TAGS_FILES = $(EXTRA_DIST) $(nodist_noinst_DATA)
+MOSTLYCLEANFILES = $(nodist_noinst_DATA)
+foo.off:
+ echo $@ >$@
+END
+: > sub2/subsub/bar.baz
+
+# No file to tag here, deliberately.
+: > sub3/Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -i
+
+./configure
+$MAKE test-tags
+$MAKE distcheck
+
+$MAKE distclean
+find . -name TAGS | grep . && exit 1
+
+:
+++ /dev/null
-#! /bin/sh
-# Copyright (C) 1997-2012 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# Test to make sure tags and subdirs work correctly. Bug report by
-# François Pinard, and later by Akim Demaille.
-
-required=etags
-. ./defs || exit 1
-
-cat >> configure.ac << 'END'
-AC_CONFIG_FILES([sub/Makefile])
-AC_OUTPUT
-END
-
-echo 'SUBDIRS = sub' > Makefile.am
-mkdir sub
-echo 'noinst_HEADERS = iguana.h' > sub/Makefile.am
-: > sub/iguana.h
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-$MAKE tags
-test -f sub/TAGS
-test -f TAGS
-$FGREP sub/TAGS TAGS
-$FGREP iguana.h sub/TAGS
-
-$MAKE distclean
-test ! -e sub/TAGS
-test ! -e TAGS
-
-: