From 6d88f1055806932d9291f96847d2b691cccda2cd Mon Sep 17 00:00:00 2001 From: "Gabriel F. T. Gomes" Date: Mon, 25 Sep 2017 23:46:54 -0300 Subject: New upstream version 2.7 --- test/.gitignore | 4 + test/Makefile.in | 387 --------------------- test/completion/2to3.exp | 1 + test/completion/7z.exp | 1 + test/completion/acroread.exp | 11 +- test/completion/adb.exp | 1 + test/completion/alpine.exp | 1 + test/completion/appdata-validate.exp | 1 + test/completion/arch.exp | 2 + test/completion/bind.exp | 1 + test/completion/change_pw.exp | 2 + test/completion/checksec.exp | 1 + test/completion/chroot.exp | 1 + test/completion/cleanarch.exp | 2 + test/completion/configure.exp | 2 +- test/completion/createuser.exp | 1 + test/completion/declare.exp | 1 + test/completion/deja-dup.exp | 1 + test/completion/dropuser.exp | 1 + test/completion/dumpdb.exp | 2 + test/completion/flake8.exp | 1 + test/completion/freebsd-update.exp | 1 + test/completion/function.exp | 1 + test/completion/genaliases.exp | 2 + test/completion/gm.exp | 1 + test/completion/gnokii.exp | 1 + test/completion/hostname.exp | 1 + test/completion/hping3.exp | 1 + test/completion/indent.exp | 1 - test/completion/inject.exp | 2 + test/completion/jpegoptim.exp | 1 + test/completion/jshint.exp | 1 + test/completion/kdvi.exp | 4 +- test/completion/kpdf.exp | 4 +- test/completion/list_owners.exp | 2 + test/completion/lz4.exp | 1 + test/completion/mailmanctl.exp | 2 + test/completion/mock.exp | 1 + test/completion/mr.exp | 1 + test/completion/newgrp.exp | 1 + test/completion/optipng.exp | 1 + test/completion/pdftotext.exp | 1 + test/completion/pngfix.exp | 1 + test/completion/portsnap.exp | 1 + test/completion/pushd.exp | 1 + test/completion/py.test.exp | 1 + test/completion/pyflakes.exp | 1 + test/completion/pyvenv.exp | 1 + test/completion/qrunner.exp | 2 + test/completion/repomanage.exp | 1 + test/completion/ssh-keygen.exp | 1 + test/completion/synclient.exp | 1 + test/completion/timeout.exp | 1 + test/completion/tipc.exp | 1 + test/completion/udevadm.exp | 1 + test/completion/unshunt.exp | 2 + test/completion/vi.exp | 4 +- test/completion/zopfli.exp | 1 + test/completion/zopflipng.exp | 1 + test/config/bashrc | 18 +- test/config/default.exp | 18 +- test/config/inputrc | 5 +- test/docker/Dockerfile-centos6 | 18 + test/docker/Dockerfile-fedoradev | 41 +++ test/docker/Dockerfile-ubuntu14 | 197 +++++++++++ test/docker/docker-script.sh | 19 + test/fixtures/7z/a.7z | Bin 0 -> 109 bytes test/fixtures/7z/f.txt | 1 + "test/fixtures/_filedir/a\"b/d" | 0 test/fixtures/_get_cword/sea | 0 test/fixtures/_get_cword/seb | 0 test/fixtures/_get_cword/sec | 0 .../\303\244\303\244\303\244\303\244\302\247" | 0 .../_known_hosts_real/.ssh/config_relative_path | 1 + test/fixtures/_known_hosts_real/config | 1 + test/fixtures/_known_hosts_real/config_full_path | 1 + test/fixtures/_known_hosts_real/config_include | 5 + .../_known_hosts_real/config_include_recursion | 1 + test/fixtures/ant/.gitignore | 2 + test/fixtures/ant/build-with-import.xml | 8 + test/fixtures/ant/build.xml | 4 +- test/fixtures/ant/imported-build.xml | 6 + test/fixtures/ant/named-build.xml | 6 + test/fixtures/java/no-complete.txt | 1 + test/fixtures/make/.gitignore | 1 + test/fixtures/make/Makefile | 34 +- test/fixtures/make/empty_dir/.nothing_here | 0 test/fixtures/make/sample.c | 1 + test/fixtures/make/sample.d | 3 + test/fixtures/make/sample.h | 0 test/fixtures/man/man3/Bash::Completion.3pm.gz | 0 test/fixtures/perl/Devel/BashCompletion.pm | 1 + test/fixtures/perldoc/BashCompletionDoc.pod | 0 test/fixtures/perldoc/BashCompletionModule.pm | 0 .../ri/BashCompletion/cdesc-BashCompletion.ri | Bin 0 -> 197 bytes test/fixtures/ri/cache.ri | Bin 0 -> 136 bytes test/fixtures/ri/created.rid | 1 + test/fixtures/scp/config | 2 + test/fixtures/sftp/config | 2 + test/fixtures/shared/empty_dir/.nothing_here | 0 test/fixtures/ssh-copy-id/.ssh/id_rsa.pub | 1 + test/fixtures/tar/archive.tar.xz | Bin 0 -> 10240 bytes test/fixtures/tar/dir/fileA | 0 test/fixtures/tar/dir/fileB | 0 test/fixtures/tar/dir/fileC | 0 test/fixtures/tar/dir/hello | 0 test/fixtures/tar/dir2/.nothing_here | 0 test/fixtures/tar/escape.tar | Bin 0 -> 10240 bytes test/generate | 64 ++++ test/lib/completions/2to3.exp | 18 + test/lib/completions/7z.exp | 37 ++ test/lib/completions/abook.exp | 2 +- test/lib/completions/adb.exp | 18 + test/lib/completions/alpine.exp | 18 + test/lib/completions/ant.exp | 15 + test/lib/completions/appdata-validate.exp | 18 + test/lib/completions/apt-get.exp | 13 +- test/lib/completions/arch.exp | 5 +- test/lib/completions/bind.exp | 21 ++ test/lib/completions/bts.exp | 21 ++ test/lib/completions/ccache.exp | 25 ++ test/lib/completions/cd.exp | 12 +- test/lib/completions/checksec.exp | 18 + test/lib/completions/chkconfig.exp | 9 +- test/lib/completions/chroot.exp | 18 + test/lib/completions/configure.exp | 8 +- test/lib/completions/createdb.exp | 4 +- test/lib/completions/createuser.exp | 18 + test/lib/completions/curl.exp | 2 +- test/lib/completions/dcop.exp | 2 +- test/lib/completions/dd.exp | 2 +- test/lib/completions/declare.exp | 26 ++ test/lib/completions/deja-dup.exp | 21 ++ test/lib/completions/dpkg.exp | 14 +- test/lib/completions/dropdb.exp | 4 +- test/lib/completions/dropuser.exp | 18 + test/lib/completions/feh.exp | 6 +- test/lib/completions/finger.exp | 4 +- test/lib/completions/flake8.exp | 18 + test/lib/completions/freebsd-update.exp | 18 + test/lib/completions/function.exp | 18 + test/lib/completions/gm.exp | 27 ++ test/lib/completions/gnokii.exp | 18 + test/lib/completions/hostname.exp | 18 + test/lib/completions/hping3.exp | 18 + test/lib/completions/ifdown.exp | 9 +- test/lib/completions/ifup.exp | 9 +- test/lib/completions/indent.exp | 20 -- test/lib/completions/ip.exp | 3 +- test/lib/completions/javac.exp | 3 +- test/lib/completions/jpegoptim.exp | 18 + test/lib/completions/jshint.exp | 18 + test/lib/completions/kill.exp | 6 +- test/lib/completions/look.exp | 2 +- test/lib/completions/ls.exp | 10 +- test/lib/completions/lz4.exp | 18 + test/lib/completions/make.exp | 38 +- test/lib/completions/man.exp | 18 +- test/lib/completions/mcrypt.exp | 4 + test/lib/completions/mmsitepass.exp | 2 +- test/lib/completions/mock.exp | 18 + test/lib/completions/modinfo.exp | 7 +- test/lib/completions/modprobe.exp | 11 +- test/lib/completions/mount.exp | 81 ----- test/lib/completions/mr.exp | 46 +++ test/lib/completions/mysql.exp | 2 + test/lib/completions/newgrp.exp | 18 + test/lib/completions/newlist.exp | 2 +- test/lib/completions/openssl.exp | 3 + test/lib/completions/optipng.exp | 18 + test/lib/completions/pdftotext.exp | 18 + test/lib/completions/perl.exp | 13 +- test/lib/completions/perldoc.exp | 5 + test/lib/completions/pine.exp | 4 +- test/lib/completions/pngfix.exp | 21 ++ test/lib/completions/portsnap.exp | 18 + test/lib/completions/puppet.exp | 3 +- test/lib/completions/pushd.exp | 18 + test/lib/completions/py.test.exp | 21 ++ test/lib/completions/pyflakes.exp | 18 + test/lib/completions/python.exp | 24 ++ test/lib/completions/pyvenv.exp | 18 + test/lib/completions/quotacheck.exp | 2 +- test/lib/completions/quotaon.exp | 2 +- test/lib/completions/renice.exp | 27 +- test/lib/completions/repomanage.exp | 18 + test/lib/completions/ri.exp | 8 +- test/lib/completions/rsync.exp | 4 +- test/lib/completions/rtcwake.exp | 2 - test/lib/completions/scp.exp | 4 +- test/lib/completions/screen.exp | 4 + test/lib/completions/sftp.exp | 8 +- test/lib/completions/ssh-copy-id.exp | 8 +- test/lib/completions/ssh-keygen.exp | 18 + test/lib/completions/ssh.exp | 18 +- test/lib/completions/synclient.exp | 26 ++ test/lib/completions/tar.exp | 118 ++++++- test/lib/completions/timeout.exp | 21 ++ test/lib/completions/tipc.exp | 18 + test/lib/completions/udevadm.exp | 18 + test/lib/completions/umount.exp | 83 ++++- test/lib/completions/unshunt.exp | 2 +- test/lib/completions/vgcreate.exp | 2 + test/lib/completions/wtf.exp | 2 +- test/lib/completions/zopfli.exp | 18 + test/lib/completions/zopflipng.exp | 18 + test/lib/library.exp | 68 ++-- test/lib/library.sh | 11 +- test/log/.gitignore | 1 + test/run | 63 ++++ test/runCompletion | 8 + test/runInstall | 7 + test/runLint | 45 +++ test/runUnit | 8 + test/tmp/.gitignore | 1 + test/unit/__expand_tilde_by_ref.exp | 12 +- test/unit/_filedir.exp | 95 ++--- test/unit/_get_cword.exp | 15 + test/unit/_known_hosts_real.exp | 28 ++ test/unit/_tilde.exp | 6 + test/unit/_variables.exp | 39 +++ 221 files changed, 2171 insertions(+), 723 deletions(-) create mode 100644 test/.gitignore delete mode 100644 test/Makefile.in create mode 100644 test/completion/2to3.exp create mode 100644 test/completion/7z.exp create mode 100644 test/completion/adb.exp create mode 100644 test/completion/alpine.exp create mode 100644 test/completion/appdata-validate.exp create mode 100644 test/completion/bind.exp create mode 100644 test/completion/checksec.exp create mode 100644 test/completion/chroot.exp create mode 100644 test/completion/createuser.exp create mode 100644 test/completion/declare.exp create mode 100644 test/completion/deja-dup.exp create mode 100644 test/completion/dropuser.exp create mode 100644 test/completion/flake8.exp create mode 100644 test/completion/freebsd-update.exp create mode 100644 test/completion/function.exp create mode 100644 test/completion/gm.exp create mode 100644 test/completion/gnokii.exp create mode 100644 test/completion/hostname.exp create mode 100644 test/completion/hping3.exp delete mode 100644 test/completion/indent.exp create mode 100644 test/completion/jpegoptim.exp create mode 100644 test/completion/jshint.exp create mode 100644 test/completion/lz4.exp create mode 100644 test/completion/mock.exp create mode 100644 test/completion/mr.exp create mode 100644 test/completion/newgrp.exp create mode 100644 test/completion/optipng.exp create mode 100644 test/completion/pdftotext.exp create mode 100644 test/completion/pngfix.exp create mode 100644 test/completion/portsnap.exp create mode 100644 test/completion/pushd.exp create mode 100644 test/completion/py.test.exp create mode 100644 test/completion/pyflakes.exp create mode 100644 test/completion/pyvenv.exp create mode 100644 test/completion/repomanage.exp create mode 100644 test/completion/ssh-keygen.exp create mode 100644 test/completion/synclient.exp create mode 100644 test/completion/timeout.exp create mode 100644 test/completion/tipc.exp create mode 100644 test/completion/udevadm.exp create mode 100644 test/completion/zopfli.exp create mode 100644 test/completion/zopflipng.exp create mode 100644 test/docker/Dockerfile-centos6 create mode 100644 test/docker/Dockerfile-fedoradev create mode 100644 test/docker/Dockerfile-ubuntu14 create mode 100755 test/docker/docker-script.sh create mode 100644 test/fixtures/7z/a.7z create mode 100644 test/fixtures/7z/f.txt delete mode 100644 "test/fixtures/_filedir/a\"b/d" create mode 100644 test/fixtures/_get_cword/sea create mode 100644 test/fixtures/_get_cword/seb create mode 100644 test/fixtures/_get_cword/sec create mode 100644 "test/fixtures/_get_cword/\303\244\303\244\303\244\303\244\302\247" create mode 100644 test/fixtures/_known_hosts_real/.ssh/config_relative_path create mode 100644 test/fixtures/_known_hosts_real/config_full_path create mode 100644 test/fixtures/_known_hosts_real/config_include create mode 100644 test/fixtures/_known_hosts_real/config_include_recursion create mode 100644 test/fixtures/ant/.gitignore create mode 100644 test/fixtures/ant/build-with-import.xml create mode 100644 test/fixtures/ant/imported-build.xml create mode 100644 test/fixtures/ant/named-build.xml create mode 100644 test/fixtures/java/no-complete.txt create mode 100644 test/fixtures/make/.gitignore delete mode 100644 test/fixtures/make/empty_dir/.nothing_here create mode 100644 test/fixtures/make/sample.d create mode 100644 test/fixtures/make/sample.h delete mode 100644 test/fixtures/man/man3/Bash::Completion.3pm.gz create mode 100644 test/fixtures/perl/Devel/BashCompletion.pm create mode 100644 test/fixtures/perldoc/BashCompletionDoc.pod create mode 100644 test/fixtures/perldoc/BashCompletionModule.pm create mode 100644 test/fixtures/ri/BashCompletion/cdesc-BashCompletion.ri create mode 100644 test/fixtures/ri/cache.ri create mode 100644 test/fixtures/ri/created.rid create mode 100644 test/fixtures/shared/empty_dir/.nothing_here create mode 100644 test/fixtures/ssh-copy-id/.ssh/id_rsa.pub create mode 100644 test/fixtures/tar/archive.tar.xz create mode 100644 test/fixtures/tar/dir/fileA create mode 100644 test/fixtures/tar/dir/fileB create mode 100644 test/fixtures/tar/dir/fileC create mode 100644 test/fixtures/tar/dir/hello create mode 100644 test/fixtures/tar/dir2/.nothing_here create mode 100644 test/fixtures/tar/escape.tar create mode 100755 test/generate create mode 100644 test/lib/completions/2to3.exp create mode 100644 test/lib/completions/7z.exp create mode 100644 test/lib/completions/adb.exp create mode 100644 test/lib/completions/alpine.exp create mode 100644 test/lib/completions/appdata-validate.exp create mode 100644 test/lib/completions/bind.exp create mode 100644 test/lib/completions/bts.exp create mode 100644 test/lib/completions/checksec.exp create mode 100644 test/lib/completions/chroot.exp create mode 100644 test/lib/completions/createuser.exp create mode 100644 test/lib/completions/declare.exp create mode 100644 test/lib/completions/deja-dup.exp create mode 100644 test/lib/completions/dropuser.exp create mode 100644 test/lib/completions/flake8.exp create mode 100644 test/lib/completions/freebsd-update.exp create mode 100644 test/lib/completions/function.exp create mode 100644 test/lib/completions/gm.exp create mode 100644 test/lib/completions/gnokii.exp create mode 100644 test/lib/completions/hostname.exp create mode 100644 test/lib/completions/hping3.exp delete mode 100644 test/lib/completions/indent.exp create mode 100644 test/lib/completions/jpegoptim.exp create mode 100644 test/lib/completions/jshint.exp create mode 100644 test/lib/completions/lz4.exp create mode 100644 test/lib/completions/mock.exp create mode 100644 test/lib/completions/mr.exp create mode 100644 test/lib/completions/newgrp.exp create mode 100644 test/lib/completions/optipng.exp create mode 100644 test/lib/completions/pdftotext.exp create mode 100644 test/lib/completions/pngfix.exp create mode 100644 test/lib/completions/portsnap.exp create mode 100644 test/lib/completions/pushd.exp create mode 100644 test/lib/completions/py.test.exp create mode 100644 test/lib/completions/pyflakes.exp create mode 100644 test/lib/completions/pyvenv.exp create mode 100644 test/lib/completions/repomanage.exp create mode 100644 test/lib/completions/ssh-keygen.exp create mode 100644 test/lib/completions/synclient.exp create mode 100644 test/lib/completions/timeout.exp create mode 100644 test/lib/completions/tipc.exp create mode 100644 test/lib/completions/udevadm.exp create mode 100644 test/lib/completions/zopfli.exp create mode 100644 test/lib/completions/zopflipng.exp create mode 100644 test/log/.gitignore create mode 100755 test/run create mode 100755 test/runCompletion create mode 100755 test/runInstall create mode 100755 test/runLint create mode 100755 test/runUnit create mode 100644 test/tmp/.gitignore create mode 100644 test/unit/_variables.exp (limited to 'test') diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 00000000..2ea9dc1e --- /dev/null +++ b/test/.gitignore @@ -0,0 +1,4 @@ +dbg.log +xtrace.log +site.exp +site.bak diff --git a/test/Makefile.in b/test/Makefile.in deleted file mode 100644 index 5cdd4f51..00000000 --- a/test/Makefile.in +++ /dev/null @@ -1,387 +0,0 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -subdir = test -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir -EXPECT = expect -RUNTEST = runtest -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -am__leading_dot = @am__leading_dot@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build_alias = @build_alias@ -builddir = @builddir@ -compatdir = @compatdir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host_alias = @host_alias@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -DEJATOOL = completion install unit -AM_RUNTESTFLAGS = --outdir log --ignore $(PACKAGE).log -EXTRA_DIST = completion \ - config \ - fixtures \ - lib \ - unit - -AUTOMAKE_OPTIONS = dejagnu -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign test/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -check-DEJAGNU: site.exp - srcdir='$(srcdir)'; export srcdir; \ - EXPECT=$(EXPECT); export EXPECT; \ - runtest=$(RUNTEST); \ - if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ - exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \ - if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \ - then :; else exit_status=1; fi; \ - done; \ - else echo "WARNING: could not find \`runtest'" 1>&2; :;\ - fi; \ - exit $$exit_status -site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG) - @echo 'Making a new site.exp file...' - @echo '## these variables are automatically generated by make ##' >site.tmp - @echo '# Do not edit here. If you wish to override these values' >>site.tmp - @echo '# edit the last section' >>site.tmp - @echo 'set srcdir "$(srcdir)"' >>site.tmp - @echo "set objdir `pwd`" >>site.tmp - @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \ - echo "## Begin content included from file $$f. Do not modify. ##" \ - && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \ - && echo "## End content included from file $$f. ##" \ - || exit 1; \ - done >> site.tmp - @echo "## End of auto-generated content; you can edit from here. ##" >> site.tmp - @if test -f site.exp; then \ - sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> site.tmp; \ - fi - @-rm -f site.bak - @test ! -f site.exp || mv site.exp site.bak - @mv site.tmp site.exp - -distclean-DEJAGNU: - -rm -f site.exp site.bak - -l='$(DEJATOOL)'; for tool in $$l; do \ - rm -f $$tool.sum $$tool.log; \ - done - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-DEJAGNU distclean-generic \ - distclean-local - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: check-am install-am install-strip - -.PHONY: all all-am check check-DEJAGNU check-am clean clean-generic \ - distclean distclean-DEJAGNU distclean-generic distclean-local \ - distdir dvi dvi-am html html-am info info-am install \ - install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am - - -all: - $(MKDIR_P) log tmp - -distclean-local: - rm -rf log tmp - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/test/completion/2to3.exp b/test/completion/2to3.exp new file mode 100644 index 00000000..9efdd77e --- /dev/null +++ b/test/completion/2to3.exp @@ -0,0 +1 @@ +assert_source_completions 2to3 diff --git a/test/completion/7z.exp b/test/completion/7z.exp new file mode 100644 index 00000000..0796b7a5 --- /dev/null +++ b/test/completion/7z.exp @@ -0,0 +1 @@ +assert_source_completions 7z diff --git a/test/completion/acroread.exp b/test/completion/acroread.exp index 6ee03d6e..95704601 100644 --- a/test/completion/acroread.exp +++ b/test/completion/acroread.exp @@ -1,12 +1,3 @@ -set test "Completion via _filedir_xspec() should be installed" -set cmd "complete -p acroread" -send "$cmd\r" - -set expected "^$cmd\r\ncomplete -F _filedir_xspec acroread\r\n/@$" -expect { - -re $expected { pass "$test" } - -re /@ { fail "$test at prompt" } -}; # expect - +assert_xspec_completion_installed acroread source "$::srcdir/lib/completions/acroread.exp" diff --git a/test/completion/adb.exp b/test/completion/adb.exp new file mode 100644 index 00000000..0da0ad12 --- /dev/null +++ b/test/completion/adb.exp @@ -0,0 +1 @@ +assert_source_completions adb diff --git a/test/completion/alpine.exp b/test/completion/alpine.exp new file mode 100644 index 00000000..04ac8b01 --- /dev/null +++ b/test/completion/alpine.exp @@ -0,0 +1 @@ +assert_source_completions alpine diff --git a/test/completion/appdata-validate.exp b/test/completion/appdata-validate.exp new file mode 100644 index 00000000..5fae5959 --- /dev/null +++ b/test/completion/appdata-validate.exp @@ -0,0 +1 @@ +assert_source_completions appdata-validate diff --git a/test/completion/arch.exp b/test/completion/arch.exp index 254acd53..25cda56f 100644 --- a/test/completion/arch.exp +++ b/test/completion/arch.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions arch +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/bind.exp b/test/completion/bind.exp new file mode 100644 index 00000000..d93003b7 --- /dev/null +++ b/test/completion/bind.exp @@ -0,0 +1 @@ +assert_source_completions bind diff --git a/test/completion/change_pw.exp b/test/completion/change_pw.exp index 0b152a1c..aed916fb 100644 --- a/test/completion/change_pw.exp +++ b/test/completion/change_pw.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions change_pw +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/checksec.exp b/test/completion/checksec.exp new file mode 100644 index 00000000..7e25e898 --- /dev/null +++ b/test/completion/checksec.exp @@ -0,0 +1 @@ +assert_source_completions checksec diff --git a/test/completion/chroot.exp b/test/completion/chroot.exp new file mode 100644 index 00000000..5cdf8f52 --- /dev/null +++ b/test/completion/chroot.exp @@ -0,0 +1 @@ +assert_source_completions chroot diff --git a/test/completion/cleanarch.exp b/test/completion/cleanarch.exp index 93646e07..504f6865 100644 --- a/test/completion/cleanarch.exp +++ b/test/completion/cleanarch.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions cleanarch +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/configure.exp b/test/completion/configure.exp index cf5611ce..16130d48 100644 --- a/test/completion/configure.exp +++ b/test/completion/configure.exp @@ -1 +1 @@ -assert_source_completions configure +source "$::srcdir/lib/completions/configure.exp" diff --git a/test/completion/createuser.exp b/test/completion/createuser.exp new file mode 100644 index 00000000..ad1c24c9 --- /dev/null +++ b/test/completion/createuser.exp @@ -0,0 +1 @@ +assert_source_completions createuser diff --git a/test/completion/declare.exp b/test/completion/declare.exp new file mode 100644 index 00000000..a62f9891 --- /dev/null +++ b/test/completion/declare.exp @@ -0,0 +1 @@ +assert_source_completions declare diff --git a/test/completion/deja-dup.exp b/test/completion/deja-dup.exp new file mode 100644 index 00000000..b2dc288d --- /dev/null +++ b/test/completion/deja-dup.exp @@ -0,0 +1 @@ +assert_source_completions deja-dup diff --git a/test/completion/dropuser.exp b/test/completion/dropuser.exp new file mode 100644 index 00000000..1be7988a --- /dev/null +++ b/test/completion/dropuser.exp @@ -0,0 +1 @@ +assert_source_completions dropuser diff --git a/test/completion/dumpdb.exp b/test/completion/dumpdb.exp index 1bfaecc8..96aee537 100644 --- a/test/completion/dumpdb.exp +++ b/test/completion/dumpdb.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions dumpdb +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/flake8.exp b/test/completion/flake8.exp new file mode 100644 index 00000000..8050e8a8 --- /dev/null +++ b/test/completion/flake8.exp @@ -0,0 +1 @@ +assert_source_completions flake8 diff --git a/test/completion/freebsd-update.exp b/test/completion/freebsd-update.exp new file mode 100644 index 00000000..80c35662 --- /dev/null +++ b/test/completion/freebsd-update.exp @@ -0,0 +1 @@ +assert_source_completions freebsd-update diff --git a/test/completion/function.exp b/test/completion/function.exp new file mode 100644 index 00000000..04c6e2b2 --- /dev/null +++ b/test/completion/function.exp @@ -0,0 +1 @@ +assert_source_completions function diff --git a/test/completion/genaliases.exp b/test/completion/genaliases.exp index eeee394f..bd33abb3 100644 --- a/test/completion/genaliases.exp +++ b/test/completion/genaliases.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions genaliases +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/gm.exp b/test/completion/gm.exp new file mode 100644 index 00000000..82177a28 --- /dev/null +++ b/test/completion/gm.exp @@ -0,0 +1 @@ +assert_source_completions gm diff --git a/test/completion/gnokii.exp b/test/completion/gnokii.exp new file mode 100644 index 00000000..4cd3055c --- /dev/null +++ b/test/completion/gnokii.exp @@ -0,0 +1 @@ +assert_source_completions gnokii diff --git a/test/completion/hostname.exp b/test/completion/hostname.exp new file mode 100644 index 00000000..3c6983ee --- /dev/null +++ b/test/completion/hostname.exp @@ -0,0 +1 @@ +assert_source_completions hostname diff --git a/test/completion/hping3.exp b/test/completion/hping3.exp new file mode 100644 index 00000000..5ffb9b06 --- /dev/null +++ b/test/completion/hping3.exp @@ -0,0 +1 @@ +assert_source_completions hping3 diff --git a/test/completion/indent.exp b/test/completion/indent.exp deleted file mode 100644 index 91eae727..00000000 --- a/test/completion/indent.exp +++ /dev/null @@ -1 +0,0 @@ -assert_source_completions indent diff --git a/test/completion/inject.exp b/test/completion/inject.exp index c2a18a46..6fcd8093 100644 --- a/test/completion/inject.exp +++ b/test/completion/inject.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions inject +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/jpegoptim.exp b/test/completion/jpegoptim.exp new file mode 100644 index 00000000..1d43b944 --- /dev/null +++ b/test/completion/jpegoptim.exp @@ -0,0 +1 @@ +assert_source_completions jpegoptim diff --git a/test/completion/jshint.exp b/test/completion/jshint.exp new file mode 100644 index 00000000..4416472c --- /dev/null +++ b/test/completion/jshint.exp @@ -0,0 +1 @@ +assert_source_completions jshint diff --git a/test/completion/kdvi.exp b/test/completion/kdvi.exp index 9f6aa664..78bd4a94 100644 --- a/test/completion/kdvi.exp +++ b/test/completion/kdvi.exp @@ -1 +1,3 @@ -assert_source_completions kdvi +assert_xspec_completion_installed kdvi + +source "$::srcdir/lib/completions/kdvi.exp" diff --git a/test/completion/kpdf.exp b/test/completion/kpdf.exp index d0a17749..53417c32 100644 --- a/test/completion/kpdf.exp +++ b/test/completion/kpdf.exp @@ -1 +1,3 @@ -assert_source_completions kpdf +assert_xspec_completion_installed kpdf + +source "$::srcdir/lib/completions/kpdf.exp" diff --git a/test/completion/list_owners.exp b/test/completion/list_owners.exp index 88262b09..9f6cf03d 100644 --- a/test/completion/list_owners.exp +++ b/test/completion/list_owners.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions list_owners +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/lz4.exp b/test/completion/lz4.exp new file mode 100644 index 00000000..9db680ed --- /dev/null +++ b/test/completion/lz4.exp @@ -0,0 +1 @@ +assert_source_completions lz4 diff --git a/test/completion/mailmanctl.exp b/test/completion/mailmanctl.exp index 2784b27c..58773291 100644 --- a/test/completion/mailmanctl.exp +++ b/test/completion/mailmanctl.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions mailmanctl +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/mock.exp b/test/completion/mock.exp new file mode 100644 index 00000000..22910a84 --- /dev/null +++ b/test/completion/mock.exp @@ -0,0 +1 @@ +assert_source_completions mock diff --git a/test/completion/mr.exp b/test/completion/mr.exp new file mode 100644 index 00000000..85f38ccd --- /dev/null +++ b/test/completion/mr.exp @@ -0,0 +1 @@ +assert_source_completions mr diff --git a/test/completion/newgrp.exp b/test/completion/newgrp.exp new file mode 100644 index 00000000..bbd12372 --- /dev/null +++ b/test/completion/newgrp.exp @@ -0,0 +1 @@ +assert_source_completions newgrp diff --git a/test/completion/optipng.exp b/test/completion/optipng.exp new file mode 100644 index 00000000..b3207543 --- /dev/null +++ b/test/completion/optipng.exp @@ -0,0 +1 @@ +assert_source_completions optipng diff --git a/test/completion/pdftotext.exp b/test/completion/pdftotext.exp new file mode 100644 index 00000000..d84cee5d --- /dev/null +++ b/test/completion/pdftotext.exp @@ -0,0 +1 @@ +assert_source_completions pdftotext diff --git a/test/completion/pngfix.exp b/test/completion/pngfix.exp new file mode 100644 index 00000000..7cea7218 --- /dev/null +++ b/test/completion/pngfix.exp @@ -0,0 +1 @@ +assert_source_completions pngfix diff --git a/test/completion/portsnap.exp b/test/completion/portsnap.exp new file mode 100644 index 00000000..424004e0 --- /dev/null +++ b/test/completion/portsnap.exp @@ -0,0 +1 @@ +assert_source_completions portsnap diff --git a/test/completion/pushd.exp b/test/completion/pushd.exp new file mode 100644 index 00000000..44556cdb --- /dev/null +++ b/test/completion/pushd.exp @@ -0,0 +1 @@ +assert_source_completions pushd diff --git a/test/completion/py.test.exp b/test/completion/py.test.exp new file mode 100644 index 00000000..8f09927d --- /dev/null +++ b/test/completion/py.test.exp @@ -0,0 +1 @@ +assert_source_completions py.test diff --git a/test/completion/pyflakes.exp b/test/completion/pyflakes.exp new file mode 100644 index 00000000..b10445f6 --- /dev/null +++ b/test/completion/pyflakes.exp @@ -0,0 +1 @@ +assert_source_completions pyflakes diff --git a/test/completion/pyvenv.exp b/test/completion/pyvenv.exp new file mode 100644 index 00000000..ce5c8a62 --- /dev/null +++ b/test/completion/pyvenv.exp @@ -0,0 +1 @@ +assert_source_completions pyvenv diff --git a/test/completion/qrunner.exp b/test/completion/qrunner.exp index 567dcb4d..e8b30af7 100644 --- a/test/completion/qrunner.exp +++ b/test/completion/qrunner.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions qrunner +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/repomanage.exp b/test/completion/repomanage.exp new file mode 100644 index 00000000..79ec53b2 --- /dev/null +++ b/test/completion/repomanage.exp @@ -0,0 +1 @@ +assert_source_completions repomanage diff --git a/test/completion/ssh-keygen.exp b/test/completion/ssh-keygen.exp new file mode 100644 index 00000000..f074b5a4 --- /dev/null +++ b/test/completion/ssh-keygen.exp @@ -0,0 +1 @@ +assert_source_completions ssh-keygen diff --git a/test/completion/synclient.exp b/test/completion/synclient.exp new file mode 100644 index 00000000..9a277096 --- /dev/null +++ b/test/completion/synclient.exp @@ -0,0 +1 @@ +assert_source_completions synclient diff --git a/test/completion/timeout.exp b/test/completion/timeout.exp new file mode 100644 index 00000000..434a291a --- /dev/null +++ b/test/completion/timeout.exp @@ -0,0 +1 @@ +assert_source_completions timeout diff --git a/test/completion/tipc.exp b/test/completion/tipc.exp new file mode 100644 index 00000000..51a6a7d7 --- /dev/null +++ b/test/completion/tipc.exp @@ -0,0 +1 @@ +assert_source_completions tipc diff --git a/test/completion/udevadm.exp b/test/completion/udevadm.exp new file mode 100644 index 00000000..69c980ff --- /dev/null +++ b/test/completion/udevadm.exp @@ -0,0 +1 @@ +assert_source_completions udevadm diff --git a/test/completion/unshunt.exp b/test/completion/unshunt.exp index fea1a7a3..9755c784 100644 --- a/test/completion/unshunt.exp +++ b/test/completion/unshunt.exp @@ -1 +1,3 @@ +assert_bash_exec {OLDPATH="$PATH"; PATH="$PATH:/usr/lib/mailman/bin"} assert_source_completions unshunt +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} diff --git a/test/completion/vi.exp b/test/completion/vi.exp index b0191404..675ea06a 100644 --- a/test/completion/vi.exp +++ b/test/completion/vi.exp @@ -1 +1,3 @@ -assert_source_completions vi +assert_xspec_completion_installed vi + +source "$::srcdir/lib/completions/vi.exp" diff --git a/test/completion/zopfli.exp b/test/completion/zopfli.exp new file mode 100644 index 00000000..086f78cf --- /dev/null +++ b/test/completion/zopfli.exp @@ -0,0 +1 @@ +assert_source_completions zopfli diff --git a/test/completion/zopflipng.exp b/test/completion/zopflipng.exp new file mode 100644 index 00000000..e16a74ab --- /dev/null +++ b/test/completion/zopflipng.exp @@ -0,0 +1 @@ +assert_source_completions zopflipng diff --git a/test/config/bashrc b/test/config/bashrc index fd72b816..d16c9033 100644 --- a/test/config/bashrc +++ b/test/config/bashrc @@ -4,7 +4,7 @@ set -o emacs # Use bash strict mode set -o posix - # Unset `command_not_found_handle' as defined on Debian/Ubuntu, because this + # Unset `command_not_found_handle' as defined on Debian/Ubuntu, because this # troubles and slows down testing unset -f command_not_found_handle # Set fixed prompt `/@' @@ -15,12 +15,21 @@ export PS2='> ' export INPUTRC=$SRCDIR/config/inputrc # When not running via cron, avoid escape junk at beginning of line from # readline, see e.g. http://bugs.gentoo.org/246091 -[ "$CRON" ] || export TERM=dummy +[ "$CRON" ] || export TERM=dumb # Ensure enough columns so expect doesn't have to care about line breaks stty columns 150 # Also test completions of system administrator commands, which are # installed via the same PATH expansion in `bash_completion.have()' export PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin + # ...as well as games on some systems not in PATH by default: +export PATH=$PATH:/usr/games:/usr/local/games + # For clean test state, avoid sourcing user's ~/.bash_completion +export BASH_COMPLETION_USER_FILE=/dev/null + # ...and avoid stuff in BASH_COMPLETION_USER_DIR overriding in-tree + # completions. The user dir is first in the lookup path, so this should also + # give precedence to the in-tree "completions" dir over other ones, e.g. + # the one possibly in /usr/share/bash-completion. +export BASH_COMPLETION_USER_DIR=$(cd "$SRCDIR/.."; pwd) # Make sure default settings are in effect unset -v \ @@ -34,8 +43,5 @@ unset -v \ # Local variables: # mode: shell-script -# sh-basic-offset: 4 -# sh-indent-comment: t -# indent-tabs-mode: nil # End: -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/test/config/default.exp b/test/config/default.exp index 1eb47a2c..246499b4 100644 --- a/test/config/default.exp +++ b/test/config/default.exp @@ -2,20 +2,20 @@ expect_after { eof { if {[info exists test]} { - fail "$test at eof" + fail "$test at eof" } elseif {[info level] > 0} { - fail "[info level 1] at eof" + fail "[info level 1] at eof" } else { fail "eof" - } - } + } + } timeout { if {[info exists test]} { - fail "$test at timeout" + fail "$test at timeout" } elseif {[info level] > 0} { - fail "[info level 1] at timeout" + fail "[info level 1] at timeout" } else { - fail "timeout" - } - } + fail "timeout" + } + } } diff --git a/test/config/inputrc b/test/config/inputrc index 33134da6..5992491a 100644 --- a/test/config/inputrc +++ b/test/config/inputrc @@ -14,8 +14,5 @@ set page-completions off # Local variables: # mode: shell-script -# sh-basic-offset: 4 -# sh-indent-comment: t -# indent-tabs-mode: nil # End: -# ex: ts=4 sw=4 et filetype=sh +# ex: filetype=sh diff --git a/test/docker/Dockerfile-centos6 b/test/docker/Dockerfile-centos6 new file mode 100644 index 00000000..8686fde4 --- /dev/null +++ b/test/docker/Dockerfile-centos6 @@ -0,0 +1,18 @@ +FROM centos:6 + +# TODO: more coverage +# /usr/bin/which: https://bugzilla.redhat.com/show_bug.cgi?id=1443357 +RUN sed -i -e /tsflags=nodocs/d /etc/yum.conf \ + && \ + yum -y install \ + https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm \ + && \ + yum -y install \ + autoconf \ + automake \ + dejagnu \ + tcllib \ + /usr/bin/xvfb-run /usr/bin/which + +WORKDIR /usr/src/bash-completion +COPY . . diff --git a/test/docker/Dockerfile-fedoradev b/test/docker/Dockerfile-fedoradev new file mode 100644 index 00000000..423f836b --- /dev/null +++ b/test/docker/Dockerfile-fedoradev @@ -0,0 +1,41 @@ +FROM fedora:rawhide + +# TODO: more coverage +# /usr/bin/which: https://bugzilla.redhat.com/show_bug.cgi?id=1443357 +RUN dnf --refresh -y install \ + autoconf \ + automake \ + dejagnu \ + tcllib \ + /usr/bin/xvfb-run /usr/bin/which \ + && \ + dnf -y install \ + /usr/bin/checksec \ + /usr/bin/compare \ + /usr/bin/dcop \ + /usr/sbin/ether-wake \ + /usr/bin/g77 \ + /usr/sbin/hping2 \ + /usr/bin/koji \ + /usr/bin/lua \ + /usr/bin/luac \ + /usr/sbin/mii-diag \ + /usr/bin/mock \ + /usr/bin/msynctool \ + /usr/bin/mutt \ + /usr/bin/ncftp \ + /usr/bin/phing \ + /usr/bin/plague-client \ + /usr/bin/pngfix \ + /usr/bin/pyvenv \ + /usr/bin/snownews \ + /usr/bin/stream \ + /usr/bin/svk \ + /usr/sbin/tipc \ + /usr/bin/wine \ + /usr/bin/wol \ + /usr/bin/xmms \ + /usr/bin/zopflipng + +WORKDIR /usr/src/bash-completion +COPY . . diff --git a/test/docker/Dockerfile-ubuntu14 b/test/docker/Dockerfile-ubuntu14 new file mode 100644 index 00000000..8db91503 --- /dev/null +++ b/test/docker/Dockerfile-ubuntu14 @@ -0,0 +1,197 @@ +FROM ubuntu:14.04 + +# TODO: more coverage +# TODO: wine needs dpkg --add-architecture i386 before apt-get update, but +# that results in apt-get update errors (some index files not found) +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + autoconf \ + automake \ + dejagnu \ + tcllib \ + xvfb \ + software-properties-common && \ + apt-add-repository multiverse && \ + apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + a2ps \ + abook \ + acpi \ + alpine \ + android-tools-adb \ + ant \ + apache2 \ + apache2-utils \ + apt-build \ + asciidoc \ + aspell \ + autoconf \ + automake \ + bc \ + bind9-host \ + bison \ + bluez \ + bridge-utils \ + bsdgames \ + ccache \ + cfengine2 \ + chrony \ + chrpath \ + cksfv \ + clisp \ + cowsay \ + cppcheck \ + cryptsetup-bin \ + cups-bsd \ + cups-client \ + curl \ + cvs \ + cvsps \ + deja-dup \ + desktop-file-utils \ + dict \ + dnsutils \ + dselect \ + dsniff \ + enscript \ + eog \ + evince \ + expat \ + fbi \ + feh \ + file-roller \ + finger \ + freerdp-x11 \ + fuse \ + gcj-jdk \ + gcl \ + gdb \ + genisoimage \ + gkrellm \ + gnat-4.6 \ + gnokii-cli \ + gnome-mplayer \ + gperf \ + gphoto2 \ + graphicsmagick \ + graphicsmagick-imagemagick-compat \ + graphviz \ + growisofs \ + grub \ + hddtemp \ + hping3 \ + htop \ + icedtea-netx \ + idn \ + iftop \ + info \ + iperf \ + ipmitool \ + iputils-arping \ + iputils-ping \ + iputils-tracepath \ + ipv6calc \ + isc-dhcp-client \ + jpegoptim \ + k3b \ + kcov \ + kplayer \ + ldap-utils \ + ldapvi \ + lftp \ + liblz4-tool \ + libuser \ + lilo \ + links \ + lrzip \ + lsof \ + lvm2 \ + lzip \ + lzop \ + mailman \ + man \ + mariadb-client-5.5 \ + mc \ + mcrypt \ + mdadm \ + medusa \ + mencoder \ + minicom \ + monodevelop \ + mplayer-gui \ + mr \ + mtx \ + mussh \ + net-tools \ + nethogs \ + network-manager \ + nfs-common \ + ngrep \ + nis \ + nodejs-legacy \ + npm \ + ntpdate \ + open-iscsi-utils \ + openjdk-7-jdk \ + openswan \ + optipng \ + p7zip-full \ + patchutils \ + perl-doc \ + pinfo \ + poppler-utils \ + postgresql-client-9.3 \ + postfix \ + prelink \ + protobuf-compiler \ + puppet-common \ + pwgen \ + pyflakes \ + pylint \ + python-flake8 \ + python-pytest \ + python3 \ + quota \ + rcs \ + rdesktop \ + reportbug \ + reptyr \ + ri \ + rpm \ + rsync \ + samba-common-bin \ + sbcl \ + screen \ + sharutils \ + sitecopy \ + smartmontools \ + smbclient \ + sqlite3 \ + strace \ + subversion \ + sysbench \ + tcpdump \ + texinfo \ + tshark \ + unace \ + unrar \ + units \ + unixodbc \ + valgrind \ + vpnc \ + wget \ + wireless-tools \ + wodim \ + wvdial \ + x11-xserver-utils \ + xserver-xorg-input-synaptics \ + xsltproc \ + xvnc4viewer \ + xzdec \ + yum \ + yum-utils \ + zopfli && \ + npm install -g jshint + +WORKDIR /usr/src/bash-completion +COPY . . diff --git a/test/docker/docker-script.sh b/test/docker/docker-script.sh new file mode 100755 index 00000000..6ba6fa90 --- /dev/null +++ b/test/docker/docker-script.sh @@ -0,0 +1,19 @@ +#!/bin/sh -ex + +export bashcomp_bash=bash +env + +autoreconf -i +./configure +make + +make -C completions check + +cd test +xvfb-run ./runCompletion --all +./runInstall --all +./runUnit --all + +cd .. +mkdir install-test +make install DESTDIR=$(pwd)/install-test diff --git a/test/fixtures/7z/a.7z b/test/fixtures/7z/a.7z new file mode 100644 index 00000000..33570649 Binary files /dev/null and b/test/fixtures/7z/a.7z differ diff --git a/test/fixtures/7z/f.txt b/test/fixtures/7z/f.txt new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/fixtures/7z/f.txt @@ -0,0 +1 @@ + diff --git "a/test/fixtures/_filedir/a\"b/d" "b/test/fixtures/_filedir/a\"b/d" deleted file mode 100644 index e69de29b..00000000 diff --git a/test/fixtures/_get_cword/sea b/test/fixtures/_get_cword/sea new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/_get_cword/seb b/test/fixtures/_get_cword/seb new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/_get_cword/sec b/test/fixtures/_get_cword/sec new file mode 100644 index 00000000..e69de29b diff --git "a/test/fixtures/_get_cword/\303\244\303\244\303\244\303\244\302\247" "b/test/fixtures/_get_cword/\303\244\303\244\303\244\303\244\302\247" new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/_known_hosts_real/.ssh/config_relative_path b/test/fixtures/_known_hosts_real/.ssh/config_relative_path new file mode 100644 index 00000000..a7ad4d14 --- /dev/null +++ b/test/fixtures/_known_hosts_real/.ssh/config_relative_path @@ -0,0 +1 @@ +Host relative_path diff --git a/test/fixtures/_known_hosts_real/config b/test/fixtures/_known_hosts_real/config index 77770ffe..1231dd79 100644 --- a/test/fixtures/_known_hosts_real/config +++ b/test/fixtures/_known_hosts_real/config @@ -2,5 +2,6 @@ # Unindented Host gee jar + HostName %h.example.com # Indented Host hus # With comment diff --git a/test/fixtures/_known_hosts_real/config_full_path b/test/fixtures/_known_hosts_real/config_full_path new file mode 100644 index 00000000..a91649b9 --- /dev/null +++ b/test/fixtures/_known_hosts_real/config_full_path @@ -0,0 +1 @@ +Include ~/config_include_recursion diff --git a/test/fixtures/_known_hosts_real/config_include b/test/fixtures/_known_hosts_real/config_include new file mode 100644 index 00000000..fe6f537e --- /dev/null +++ b/test/fixtures/_known_hosts_real/config_include @@ -0,0 +1,5 @@ +#$HOME set to fixtures/_known_hosts_real in unit test +# Include with full path (recursive one) +Include ~/config_full_path +# Include with relative path +Include config_relative_path diff --git a/test/fixtures/_known_hosts_real/config_include_recursion b/test/fixtures/_known_hosts_real/config_include_recursion new file mode 100644 index 00000000..27770690 --- /dev/null +++ b/test/fixtures/_known_hosts_real/config_include_recursion @@ -0,0 +1 @@ +Host recursion diff --git a/test/fixtures/ant/.gitignore b/test/fixtures/ant/.gitignore new file mode 100644 index 00000000..459f1019 --- /dev/null +++ b/test/fixtures/ant/.gitignore @@ -0,0 +1,2 @@ +.ant-targets-build.xml +.ant-targets-named-build.xml diff --git a/test/fixtures/ant/build-with-import.xml b/test/fixtures/ant/build-with-import.xml new file mode 100644 index 00000000..881981a5 --- /dev/null +++ b/test/fixtures/ant/build-with-import.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test/fixtures/ant/build.xml b/test/fixtures/ant/build.xml index 146c7f3b..09b4cd2a 100644 --- a/test/fixtures/ant/build.xml +++ b/test/fixtures/ant/build.xml @@ -8,9 +8,9 @@ - + diff --git a/test/fixtures/ant/imported-build.xml b/test/fixtures/ant/imported-build.xml new file mode 100644 index 00000000..0cc438f0 --- /dev/null +++ b/test/fixtures/ant/imported-build.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/fixtures/ant/named-build.xml b/test/fixtures/ant/named-build.xml new file mode 100644 index 00000000..e61386d5 --- /dev/null +++ b/test/fixtures/ant/named-build.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/fixtures/java/no-complete.txt b/test/fixtures/java/no-complete.txt new file mode 100644 index 00000000..8ca1ef6a --- /dev/null +++ b/test/fixtures/java/no-complete.txt @@ -0,0 +1 @@ +This file should not be included in classpath etc completions. diff --git a/test/fixtures/make/.gitignore b/test/fixtures/make/.gitignore new file mode 100644 index 00000000..3d1325c6 --- /dev/null +++ b/test/fixtures/make/.gitignore @@ -0,0 +1 @@ +extra_makefile diff --git a/test/fixtures/make/Makefile b/test/fixtures/make/Makefile index 1a6416cd..b04a6eb2 100644 --- a/test/fixtures/make/Makefile +++ b/test/fixtures/make/Makefile @@ -1,10 +1,15 @@ +$(info confuse: make) + +CFLAGS=-MMD -MP NAME := sample .PHONY: all all: $(NAME) -$(NAME): sample.c - cc -o $@ $^ +$(NAME): sample.o + +.INTERMEDIATE: sample.o +sample.o: sample.c .PHONY: install install: all @@ -14,3 +19,28 @@ install: all .PHONY: clean clean: -rm -f $(NAME) + +.test_passes: + ./sample >/dev/null + touch ^@ + +.cache/.1: + touch $@ + +.cache/.2: + touch $@ + +.cache/1: + touch $@ + +.cache/2: + touch $@ + +ifndef __BASH_MAKE_COMPLETION__ +-include sample.d +endif + +VARIABLE_LOOKS_A_BIT_LIKE_A_TARGET := fooled-you +extra_makefile: + touch $@ +include extra_makefile diff --git a/test/fixtures/make/empty_dir/.nothing_here b/test/fixtures/make/empty_dir/.nothing_here deleted file mode 100644 index e69de29b..00000000 diff --git a/test/fixtures/make/sample.c b/test/fixtures/make/sample.c index 2be4600f..4212596a 100644 --- a/test/fixtures/make/sample.c +++ b/test/fixtures/make/sample.c @@ -1,4 +1,5 @@ #include +#include "sample.h" int main(void) { diff --git a/test/fixtures/make/sample.d b/test/fixtures/make/sample.d new file mode 100644 index 00000000..27979ffb --- /dev/null +++ b/test/fixtures/make/sample.d @@ -0,0 +1,3 @@ +sample.o: sample.c sample.h + +sample.h: diff --git a/test/fixtures/make/sample.h b/test/fixtures/make/sample.h new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/man/man3/Bash::Completion.3pm.gz b/test/fixtures/man/man3/Bash::Completion.3pm.gz deleted file mode 100644 index e69de29b..00000000 diff --git a/test/fixtures/perl/Devel/BashCompletion.pm b/test/fixtures/perl/Devel/BashCompletion.pm new file mode 100644 index 00000000..0afc6045 --- /dev/null +++ b/test/fixtures/perl/Devel/BashCompletion.pm @@ -0,0 +1 @@ +1; diff --git a/test/fixtures/perldoc/BashCompletionDoc.pod b/test/fixtures/perldoc/BashCompletionDoc.pod new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/perldoc/BashCompletionModule.pm b/test/fixtures/perldoc/BashCompletionModule.pm new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/ri/BashCompletion/cdesc-BashCompletion.ri b/test/fixtures/ri/BashCompletion/cdesc-BashCompletion.ri new file mode 100644 index 00000000..7263da8c Binary files /dev/null and b/test/fixtures/ri/BashCompletion/cdesc-BashCompletion.ri differ diff --git a/test/fixtures/ri/cache.ri b/test/fixtures/ri/cache.ri new file mode 100644 index 00000000..4a8fc662 Binary files /dev/null and b/test/fixtures/ri/cache.ri differ diff --git a/test/fixtures/ri/created.rid b/test/fixtures/ri/created.rid new file mode 100644 index 00000000..ced9a4e0 --- /dev/null +++ b/test/fixtures/ri/created.rid @@ -0,0 +1 @@ +Sat, 29 Apr 2017 07:21:09 +0000 diff --git a/test/fixtures/scp/config b/test/fixtures/scp/config index fea6620e..9f94b9ef 100644 --- a/test/fixtures/scp/config +++ b/test/fixtures/scp/config @@ -4,3 +4,5 @@ UserKnownHostsFile known_hosts Host gee # Indented, multiple hosts HostName hus ike + +Host hut diff --git a/test/fixtures/sftp/config b/test/fixtures/sftp/config index fea6620e..9f94b9ef 100644 --- a/test/fixtures/sftp/config +++ b/test/fixtures/sftp/config @@ -4,3 +4,5 @@ UserKnownHostsFile known_hosts Host gee # Indented, multiple hosts HostName hus ike + +Host hut diff --git a/test/fixtures/shared/empty_dir/.nothing_here b/test/fixtures/shared/empty_dir/.nothing_here new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/ssh-copy-id/.ssh/id_rsa.pub b/test/fixtures/ssh-copy-id/.ssh/id_rsa.pub new file mode 100644 index 00000000..4c656eba --- /dev/null +++ b/test/fixtures/ssh-copy-id/.ssh/id_rsa.pub @@ -0,0 +1 @@ +ssh-rsa meh comment diff --git a/test/fixtures/tar/archive.tar.xz b/test/fixtures/tar/archive.tar.xz new file mode 100644 index 00000000..c8d27256 Binary files /dev/null and b/test/fixtures/tar/archive.tar.xz differ diff --git a/test/fixtures/tar/dir/fileA b/test/fixtures/tar/dir/fileA new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/tar/dir/fileB b/test/fixtures/tar/dir/fileB new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/tar/dir/fileC b/test/fixtures/tar/dir/fileC new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/tar/dir/hello b/test/fixtures/tar/dir/hello new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/tar/dir2/.nothing_here b/test/fixtures/tar/dir2/.nothing_here new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/tar/escape.tar b/test/fixtures/tar/escape.tar new file mode 100644 index 00000000..7af7e9f2 Binary files /dev/null and b/test/fixtures/tar/escape.tar differ diff --git a/test/generate b/test/generate new file mode 100755 index 00000000..deeba05a --- /dev/null +++ b/test/generate @@ -0,0 +1,64 @@ +#!/bin/bash -eu +# Generate skeleton files for completion of specified command. +# Test skeleton files are generated as well. +# @param $1 string Command, e.g. 'make' +# @param $2 string Completion function, e.g. _command +# @param $3 string Completion arguments, e.g. '-o filenames' + + +# Generate test code +# @param $1 string Command, e.g. 'make' +generate_test_completion() { + local path="completion/$1.exp" + # Does file already exist? + #if [ ! -f "$path" ]; then + # No, file doesn't exist; generate file + cat < "$path" +assert_source_completions $1 +EXPECT + #fi +} # generate_test_completion() + + +# Generate test code +# @param $1 string Command, e.g. 'make' +# @param $2 string Completion function, e.g. _command +# @param $3 string Completion arguments, e.g. ' -o filenames' +generate_test_lib_completions() { + local path="lib/completions/$1.exp" + # Does file already exist? + #if [ ! -f "$path" ]; then + # No, file doesn't exist; generate file + cat < "$path" +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "$1 " +sync_after_int + + +teardown +EXPECT + #fi +} # generate_test_lib_completions() + + + # If argument count is wrong, show help +if [ $# -ne 1 ]; then + echo "Usage: $0 command" + echo "Example: $0 make" + exit 1 +fi + +generate_test_completion "$1" +generate_test_lib_completions "$1" diff --git a/test/lib/completions/2to3.exp b/test/lib/completions/2to3.exp new file mode 100644 index 00000000..101fbf87 --- /dev/null +++ b/test/lib/completions/2to3.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "2to3 " +sync_after_int + + +teardown diff --git a/test/lib/completions/7z.exp b/test/lib/completions/7z.exp new file mode 100644 index 00000000..4e7e8689 --- /dev/null +++ b/test/lib/completions/7z.exp @@ -0,0 +1,37 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified {/OLDPWD=/d} +} + + +setup + + +assert_complete_any "7z " +sync_after_int + + +assert_complete "-tzip" "7z a ar -tzi" +sync_after_int + + +set dir $::srcdir/fixtures/_filedir +assert_complete_dir "-wa\\ b/" "7z x -wa\\ " $dir "" -nospace +sync_after_int + + +set dir $::srcdir/fixtures/7z +assert_complete_dir "a.7z" "7z x " $dir +sync_after_int + + +set dir $::srcdir/fixtures/7z +assert_complete_dir "abc" "7z d a.7z " $dir +sync_after_int + + +teardown diff --git a/test/lib/completions/abook.exp b/test/lib/completions/abook.exp index 43f62729..463a28c0 100644 --- a/test/lib/completions/abook.exp +++ b/test/lib/completions/abook.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -assert_complete_any "abook " +assert_complete_any "abook -" sync_after_int diff --git a/test/lib/completions/adb.exp b/test/lib/completions/adb.exp new file mode 100644 index 00000000..0d41fd2d --- /dev/null +++ b/test/lib/completions/adb.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "adb " +sync_after_int + + +teardown diff --git a/test/lib/completions/alpine.exp b/test/lib/completions/alpine.exp new file mode 100644 index 00000000..5ae1901c --- /dev/null +++ b/test/lib/completions/alpine.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "alpine -" +sync_after_int + + +teardown diff --git a/test/lib/completions/ant.exp b/test/lib/completions/ant.exp index acff23ec..bcf87711 100644 --- a/test/lib/completions/ant.exp +++ b/test/lib/completions/ant.exp @@ -6,6 +6,7 @@ proc setup {} { proc teardown {} { assert_env_unmodified { /OLDPWD=/d + /ANT_ARGS=/d } } @@ -21,4 +22,18 @@ assert_complete_dir "bashcomp clean init realclean" "ant " $::srcdir/fixtures/an sync_after_int +assert_complete_dir "named-build" "ant -f named-build.xml " $::srcdir/fixtures/ant +sync_after_int + + +assert_complete_dir "build-with-import imported-build" "ant -f build-with-import.xml " $::srcdir/fixtures/ant +sync_after_int + + +assert_bash_exec {OLD_ANT_ARGS=$ANT_ARGS; ANT_ARGS="-f named-build.xml"} +assert_complete_dir "named-build" "ant " $::srcdir/fixtures/ant "ant with buildfile from ANT_ARGS" +sync_after_int +assert_bash_exec {ANT_ARGS=$OLD_ANT_ARGS; unset -v OLD_ANT_ARGS} + + teardown diff --git a/test/lib/completions/appdata-validate.exp b/test/lib/completions/appdata-validate.exp new file mode 100644 index 00000000..583c2952 --- /dev/null +++ b/test/lib/completions/appdata-validate.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "appdata-validate " +sync_after_int + + +teardown diff --git a/test/lib/completions/apt-get.exp b/test/lib/completions/apt-get.exp index 66887bd0..270d6fe8 100644 --- a/test/lib/completions/apt-get.exp +++ b/test/lib/completions/apt-get.exp @@ -11,11 +11,14 @@ proc teardown {} { setup -set commands {autoclean autoremove build-dep check clean dist-upgrade - dselect-upgrade install purge remove source update upgrade} -assert_complete $commands "apt-get " - - +set test "Tab should complete commands" +set cmd "apt-get " +send "$cmd\t" +set expected "^$cmd\r\n.* install .* update .*\r\n/@$cmd$" +expect { + -re $expected { pass "$test" } + default { fail "$test" } +} sync_after_int diff --git a/test/lib/completions/arch.exp b/test/lib/completions/arch.exp index 0550c76b..5bad0e60 100644 --- a/test/lib/completions/arch.exp +++ b/test/lib/completions/arch.exp @@ -11,10 +11,7 @@ proc teardown {} { setup -set options {--wipe -s --start= -e --end= -q --quiet -h --help} -assert_complete $options "arch -" - - +assert_complete_any "arch -" sync_after_int diff --git a/test/lib/completions/bind.exp b/test/lib/completions/bind.exp new file mode 100644 index 00000000..09bbaaa1 --- /dev/null +++ b/test/lib/completions/bind.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "bind -" +sync_after_int + +assert_complete_any "bind k" +sync_after_int + + +teardown diff --git a/test/lib/completions/bts.exp b/test/lib/completions/bts.exp new file mode 100644 index 00000000..38b92b9d --- /dev/null +++ b/test/lib/completions/bts.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "bts -" +sync_after_int + +assert_complete "bts " +sync_after_int + + +teardown diff --git a/test/lib/completions/ccache.exp b/test/lib/completions/ccache.exp index 156c881a..7cb3103e 100644 --- a/test/lib/completions/ccache.exp +++ b/test/lib/completions/ccache.exp @@ -15,4 +15,29 @@ assert_complete_any "ccache -" sync_after_int +set test "Tab should offer correct options from partial option" +assert_complete_partial [list "--cleanup" "--clear"] "ccache" "--clea" $test +sync_after_int + + +set test "Tab should complete a command after ccache" +assert_complete [list "stty"] "ccache stt" $test +sync_after_int + + +set test "Tab should complete a command after ccache --FLAG" +assert_complete [list "stty"] "ccache --zero-stats stt" $test +sync_after_int + + +set test "Tab should complete a command's flags after ccache" +assert_complete [list "--help"] "ccache ls --hel" $test +sync_after_int + + +set test "Tab should complete a command's flags after ccache --FLAG" +assert_complete [list "--help"] "ccache --zero-stats ls --hel" $test +sync_after_int + + teardown diff --git a/test/lib/completions/cd.exp b/test/lib/completions/cd.exp index 55bae158..6f36c881 100644 --- a/test/lib/completions/cd.exp +++ b/test/lib/completions/cd.exp @@ -4,7 +4,7 @@ proc setup {} { proc teardown {} { - assert_env_unmodified + assert_env_unmodified {/OLDPWD=/d} } @@ -42,7 +42,15 @@ assert_bash_exec "CDPATH=\$PWD"; assert_complete "$::srcdir/fixtures/shared/default/foo.d/" \ "cd $::srcdir/fixtures/shared/default/fo" $test -nospace -expect-cmd-minus fo sync_after_int - # Reset CDPATH + +assert_bash_exec "unset CDPATH" +# Assuming no subdirs here +assert_bash_exec "cd $::srcdir/fixtures/shared/default/foo.d" +assert_no_complete "cd " "cd shouldn't complete when there are no subdirs or CDPATH" +sync_after_int + + # Reset PWD and CDPATH +assert_bash_exec "cd \"\$OLDPWD\"" assert_bash_exec "declare -p OLDCDPATH &>/dev/null && CDPATH=\$OLDCDPATH || unset CDPATH && unset OLDCDPATH" diff --git a/test/lib/completions/checksec.exp b/test/lib/completions/checksec.exp new file mode 100644 index 00000000..03abd575 --- /dev/null +++ b/test/lib/completions/checksec.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "checksec -" +sync_after_int + + +teardown diff --git a/test/lib/completions/chkconfig.exp b/test/lib/completions/chkconfig.exp index dae3b3bd..1714144d 100644 --- a/test/lib/completions/chkconfig.exp +++ b/test/lib/completions/chkconfig.exp @@ -11,9 +11,16 @@ proc teardown {} { setup -assert_complete_any "chkconfig " +assert_complete_any "chkconfig -" +sync_after_int +# systemd may not be running e.g. in a docker container, and listing services +# will then fail. +if {[assert_exec {systemctl list-units} "" "" "unsupported" ]} { + # TODO test this also if systemctl command is not available at all + assert_complete_any "chkconfig " +} sync_after_int diff --git a/test/lib/completions/chroot.exp b/test/lib/completions/chroot.exp new file mode 100644 index 00000000..ba9f63a1 --- /dev/null +++ b/test/lib/completions/chroot.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "chroot " +sync_after_int + + +teardown diff --git a/test/lib/completions/configure.exp b/test/lib/completions/configure.exp index b4399cb1..1be8e167 100644 --- a/test/lib/completions/configure.exp +++ b/test/lib/completions/configure.exp @@ -1,19 +1,23 @@ proc setup {} { + # Make sure our own ./configure is in PATH + assert_bash_exec {OLDPATH="$PATH"; PATH="$SRCDIR/..:$PATH"} save_env } proc teardown {} { assert_env_unmodified + assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} } setup -assert_complete_any "configure --prefix " - +assert_complete_any "configure --" +sync_after_int +assert_complete_any "configure --prefix " sync_after_int diff --git a/test/lib/completions/createdb.exp b/test/lib/completions/createdb.exp index aafff1b6..234817f9 100644 --- a/test/lib/completions/createdb.exp +++ b/test/lib/completions/createdb.exp @@ -11,9 +11,7 @@ proc teardown {} { setup -assert_complete_any "createdb " - - +assert_complete_any "createdb -" sync_after_int diff --git a/test/lib/completions/createuser.exp b/test/lib/completions/createuser.exp new file mode 100644 index 00000000..87d4ac87 --- /dev/null +++ b/test/lib/completions/createuser.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "createuser -" +sync_after_int + + +teardown diff --git a/test/lib/completions/curl.exp b/test/lib/completions/curl.exp index 53512bc4..e05c023e 100644 --- a/test/lib/completions/curl.exp +++ b/test/lib/completions/curl.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -assert_complete_any "curl -" +assert_complete_any "curl --h" sync_after_int diff --git a/test/lib/completions/dcop.exp b/test/lib/completions/dcop.exp index 1e27346b..dcff2802 100644 --- a/test/lib/completions/dcop.exp +++ b/test/lib/completions/dcop.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -if {[assert_exec {dcop} words]} { +if {[assert_exec {dcop} words "" "untested"]} { assert_complete $words "dcop " } diff --git a/test/lib/completions/dd.exp b/test/lib/completions/dd.exp index e02e037c..4946e54d 100644 --- a/test/lib/completions/dd.exp +++ b/test/lib/completions/dd.exp @@ -18,7 +18,7 @@ sync_after_int set test "option should be suffixed with =" -set cmd "dd if" +set cmd "dd bs" send "$cmd\t" expect -ex "$cmd" expect { diff --git a/test/lib/completions/declare.exp b/test/lib/completions/declare.exp new file mode 100644 index 00000000..8830b676 --- /dev/null +++ b/test/lib/completions/declare.exp @@ -0,0 +1,26 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "declare -" +sync_after_int + +assert_complete_any "declare +" +sync_after_int + +assert_complete {BASH_ARGC BASH_ARGV} "declare -p BASH_ARG" +sync_after_int + +assert_complete_any "declare -f _parse_" +sync_after_int + +teardown diff --git a/test/lib/completions/deja-dup.exp b/test/lib/completions/deja-dup.exp new file mode 100644 index 00000000..d46549cf --- /dev/null +++ b/test/lib/completions/deja-dup.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "deja-dup -" +sync_after_int + +assert_no_complete "deja-dup --help " +sync_after_int + + +teardown diff --git a/test/lib/completions/dpkg.exp b/test/lib/completions/dpkg.exp index f358e172..0ea6ded3 100644 --- a/test/lib/completions/dpkg.exp +++ b/test/lib/completions/dpkg.exp @@ -12,17 +12,23 @@ setup assert_complete_any "dpkg --c" - - sync_after_int - # Build list of installed packages -if {[assert_exec {dpkg --get-selections | command grep \[\[:space:\]\]install$ | cut -f1} packages]} { +# Build list of installed packages +if {[assert_exec {dpkg --get-selections | command grep \[\[:space:\]\]install$ | cut -f1} packages "" "untested"]} { assert_complete $packages "dpkg -L " } +sync_after_int +set test "dpkg -i ~part should complete to ~full/ if home dir exists" +# https://bugs.debian.org/864691 +# Create list of users, having existing home dir +assert_bash_exec {for u in $(compgen -u); do \ + eval test -d ~$u && echo $u; unset u; done} {} /@ users +find_unique_completion_pair $users part full +assert_complete "~$full/" "dpkg -i ~$part" $test -nospace sync_after_int diff --git a/test/lib/completions/dropdb.exp b/test/lib/completions/dropdb.exp index 8f2d5bfb..d68cd48a 100644 --- a/test/lib/completions/dropdb.exp +++ b/test/lib/completions/dropdb.exp @@ -11,9 +11,7 @@ proc teardown {} { setup -assert_complete_any "dropdb " - - +assert_complete_any "dropdb -" sync_after_int diff --git a/test/lib/completions/dropuser.exp b/test/lib/completions/dropuser.exp new file mode 100644 index 00000000..8b36fa5e --- /dev/null +++ b/test/lib/completions/dropuser.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "dropuser " +sync_after_int + + +teardown diff --git a/test/lib/completions/feh.exp b/test/lib/completions/feh.exp index 129e1f4d..28e90d99 100644 --- a/test/lib/completions/feh.exp +++ b/test/lib/completions/feh.exp @@ -17,8 +17,10 @@ assert_complete_any "feh " sync_after_int -set test "--lis should complete \"--list\"" -assert_complete "--list" "feh --lis" $test +if {[assert_exec {feh --help | grep "man feh" || exit 1} "" "" "unsupported"]} { + set test "--lis should complete \"--list\"" + assert_complete "--list" "feh --lis" $test +} sync_after_int diff --git a/test/lib/completions/finger.exp b/test/lib/completions/finger.exp index f11d11fe..5a3d3e9e 100644 --- a/test/lib/completions/finger.exp +++ b/test/lib/completions/finger.exp @@ -14,7 +14,7 @@ setup set test "Tab should complete usernames" # Build string list of usernames set users {} -foreach u [exec bash -c "compgen -A user"] { +foreach u [exec bash -c "compgen -A user -S @"] { lappend users $u } assert_complete $users "finger " $test @@ -24,7 +24,7 @@ sync_after_int set test "Tab should complete partial username" -assert_complete_partial [exec bash -c "compgen -A user"] "finger" "" $test -nospace +assert_complete_partial [exec bash -c "compgen -A user -S @"] "finger" "" $test -nospace sync_after_int diff --git a/test/lib/completions/flake8.exp b/test/lib/completions/flake8.exp new file mode 100644 index 00000000..469f96ed --- /dev/null +++ b/test/lib/completions/flake8.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "flake8 " +sync_after_int + + +teardown diff --git a/test/lib/completions/freebsd-update.exp b/test/lib/completions/freebsd-update.exp new file mode 100644 index 00000000..3657ebfd --- /dev/null +++ b/test/lib/completions/freebsd-update.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "freebsd-update " +sync_after_int + + +teardown diff --git a/test/lib/completions/function.exp b/test/lib/completions/function.exp new file mode 100644 index 00000000..823811f1 --- /dev/null +++ b/test/lib/completions/function.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "function _parse_" +sync_after_int + + +teardown diff --git a/test/lib/completions/gm.exp b/test/lib/completions/gm.exp new file mode 100644 index 00000000..43f0bce2 --- /dev/null +++ b/test/lib/completions/gm.exp @@ -0,0 +1,27 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "gm " +sync_after_int + +assert_complete_any "gm help " +sync_after_int + +assert_complete_any "gm time " +sync_after_int + +assert_no_complete "gm version " +sync_after_int + + +teardown diff --git a/test/lib/completions/gnokii.exp b/test/lib/completions/gnokii.exp new file mode 100644 index 00000000..11bfeb6c --- /dev/null +++ b/test/lib/completions/gnokii.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "gnokii " +sync_after_int + + +teardown diff --git a/test/lib/completions/hostname.exp b/test/lib/completions/hostname.exp new file mode 100644 index 00000000..9d9e4963 --- /dev/null +++ b/test/lib/completions/hostname.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "hostname -" +sync_after_int + + +teardown diff --git a/test/lib/completions/hping3.exp b/test/lib/completions/hping3.exp new file mode 100644 index 00000000..991ee3ad --- /dev/null +++ b/test/lib/completions/hping3.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "hping3 " +sync_after_int + + +teardown diff --git a/test/lib/completions/ifdown.exp b/test/lib/completions/ifdown.exp index 7849f3f7..7341ceb8 100644 --- a/test/lib/completions/ifdown.exp +++ b/test/lib/completions/ifdown.exp @@ -11,9 +11,14 @@ proc teardown {} { setup -assert_complete_any "ifdown " - +if {[info exists ::env(CI)]} { + unsupported "ifdown should show completions" +} else { + assert_complete_any "ifdown " + sync_after_int +} +assert_no_complete "ifdown bash-completion " sync_after_int diff --git a/test/lib/completions/ifup.exp b/test/lib/completions/ifup.exp index 2c1c010e..31b5ade4 100644 --- a/test/lib/completions/ifup.exp +++ b/test/lib/completions/ifup.exp @@ -11,9 +11,14 @@ proc teardown {} { setup -assert_complete_any "ifup " - +if {[info exists ::env(CI)]} { + unsupported "ifup should show completions" +} else { + assert_complete_any "ifup " + sync_after_int +} +assert_no_complete "ifup bash-completion " sync_after_int diff --git a/test/lib/completions/indent.exp b/test/lib/completions/indent.exp deleted file mode 100644 index 5c5bb1c7..00000000 --- a/test/lib/completions/indent.exp +++ /dev/null @@ -1,20 +0,0 @@ -proc setup {} { - save_env -} - - -proc teardown {} { - assert_env_unmodified -} - - -setup - - -assert_complete_any "indent --" - - -sync_after_int - - -teardown diff --git a/test/lib/completions/ip.exp b/test/lib/completions/ip.exp index 8f45f6a3..f57712cb 100644 --- a/test/lib/completions/ip.exp +++ b/test/lib/completions/ip.exp @@ -12,8 +12,9 @@ setup assert_complete_any "ip " +sync_after_int - +assert_complete_any "ip a " sync_after_int diff --git a/test/lib/completions/javac.exp b/test/lib/completions/javac.exp index 948fe8c8..83b11d7f 100644 --- a/test/lib/completions/javac.exp +++ b/test/lib/completions/javac.exp @@ -12,8 +12,9 @@ setup assert_complete_any "javac " +sync_after_int - +assert_complete "a/ bashcomp.jar" "javac -cp $::srcdir/fixtures/java/" sync_after_int diff --git a/test/lib/completions/jpegoptim.exp b/test/lib/completions/jpegoptim.exp new file mode 100644 index 00000000..4b735e80 --- /dev/null +++ b/test/lib/completions/jpegoptim.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "jpegoptim " +sync_after_int + + +teardown diff --git a/test/lib/completions/jshint.exp b/test/lib/completions/jshint.exp new file mode 100644 index 00000000..553883e1 --- /dev/null +++ b/test/lib/completions/jshint.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "jshint " +sync_after_int + + +teardown diff --git a/test/lib/completions/kill.exp b/test/lib/completions/kill.exp index bc07bc48..9aeb8412 100644 --- a/test/lib/completions/kill.exp +++ b/test/lib/completions/kill.exp @@ -11,8 +11,10 @@ proc teardown {} { setup -assert_complete_any "kill 1" -sync_after_int +if {[assert_bash_type ps]} { + assert_complete_any "kill 1" + sync_after_int +} assert_complete [get_signals] "kill -s " diff --git a/test/lib/completions/look.exp b/test/lib/completions/look.exp index 8f93db24..af9a71a8 100644 --- a/test/lib/completions/look.exp +++ b/test/lib/completions/look.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -if {[assert_exec {look foo | grep ^foo} words]} { +if {[assert_exec {look foo | grep ^foo} words {} "unsupported"]} { assert_complete $words "look foo" } diff --git a/test/lib/completions/ls.exp b/test/lib/completions/ls.exp index 0d16ec03..e176e13f 100644 --- a/test/lib/completions/ls.exp +++ b/test/lib/completions/ls.exp @@ -14,30 +14,24 @@ setup if {[assert_exec {ls --help} "" "" "unsupported"]} { assert_complete_any "ls --" } - - sync_after_int -set test "~part should complete to ~full/ if existing dir" +set test "~part should complete to ~full/ if home dir exists" # Create list of users, having existing home dir assert_bash_exec {for u in $(compgen -u); do \ eval test -d ~$u && echo $u; unset u; done} {} /@ users find_unique_completion_pair $users part full assert_complete "~$full/" "ls ~$part" $test -nospace - - sync_after_int -set test "~part should complete to ~full if non-existing dir" +set test "~part should complete to ~full if home dir does not exist" # Create list of users, having non-existing home dir assert_bash_exec {for u in $(compgen -u); do \ eval test -d ~$u || echo $u; unset u; done} {} /@ users find_unique_completion_pair $users part full assert_complete "~$full " "ls ~$part" $test -nospace - - sync_after_int diff --git a/test/lib/completions/lz4.exp b/test/lib/completions/lz4.exp new file mode 100644 index 00000000..df392939 --- /dev/null +++ b/test/lib/completions/lz4.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "lz4 " +sync_after_int + + +teardown diff --git a/test/lib/completions/make.exp b/test/lib/completions/make.exp index 977485d2..0c188dba 100644 --- a/test/lib/completions/make.exp +++ b/test/lib/completions/make.exp @@ -18,18 +18,50 @@ assert_complete_dir "Makefile" "make -f Ma" $dir $test sync_after_int - set test "\"make \" should complete targets" set dir $::srcdir/fixtures/make -set targets "all sample install clean" +set targets "all sample install clean extra_makefile" +file delete $dir/extra_makefile assert_complete_dir $targets "make " $dir $test sync_after_int +set test "\"make .\" should complete hidden targets" +set dir $::srcdir/fixtures/make +set targets ".test_passes .cache/" +assert_complete_dir $targets "make ." $dir $test + + +sync_after_int + + +set test "\"make .cache/\" should complete targets" +set dir $::srcdir/fixtures/make +set targets "1 2" +assert_complete_dir $targets "make .cache/" $dir $test + + +sync_after_int + + +# FIXME: for some reason this fails in centos6, even though the behavior +# appears to be correct; skip in CI for now. +set test "\"make .cache/.\" should complete hidden targets" +if {[info exists ::env(CI)] && [info exists ::env(DIST)] && $::env(DIST) == "centos6"} { + xfail $test +} else { + set dir $::srcdir/fixtures/make + set targets ".1 .2" + assert_complete_dir $targets "make .cache/." $dir $test \ + -expect-cmd-minus "." + sync_after_int +} + + set test "\"make \" should not show anything in directory without makefile" -set dir $::srcdir/fixtures/make/empty_dir +set dir $::srcdir/fixtures/shared/empty_dir assert_complete_dir "" "make " $dir $test diff --git a/test/lib/completions/man.exp b/test/lib/completions/man.exp index 66b565a2..1a031ff1 100644 --- a/test/lib/completions/man.exp +++ b/test/lib/completions/man.exp @@ -1,11 +1,19 @@ proc setup {} { - assert_bash_exec "export MANPATH=$::srcdirabs/fixtures/man" + assert_bash_exec "export MANPATH=$::srcdirabs/fixtures/man:$::srcdirabs/tmp/man" save_env + + if {! [is_cygwin]} { # Colon not allowed in filenames + assert_bash_exec {(cd $TESTDIR/tmp && mkdir -p man/man3 && touch man/man3/Bash::Completion.3pm.gz || true)} + } } proc teardown {} { assert_env_unmodified {/OLDPWD/d} + + if {! [is_cygwin]} { + assert_bash_exec {(cd $TESTDIR/tmp && rm -r man || true)} + } } @@ -24,10 +32,10 @@ assert_complete_dir oo.1 "man man1/f" $::srcdir/fixtures/man sync_after_int -assert_complete "Bash::Completion" "man Bash::C" - - -sync_after_int +if {! [is_cygwin]} { + assert_complete "Bash::Completion" "man Bash::C" + sync_after_int +} assert_complete_dir "man/quux.8" "man man/" $::srcdir/fixtures/man diff --git a/test/lib/completions/mcrypt.exp b/test/lib/completions/mcrypt.exp index 525ccbc3..e194446b 100644 --- a/test/lib/completions/mcrypt.exp +++ b/test/lib/completions/mcrypt.exp @@ -12,8 +12,12 @@ setup assert_complete_any "mcrypt " +sync_after_int +assert_complete_any "mcrypt -a " +sync_after_int +assert_complete_any "mcrypt -m " sync_after_int diff --git a/test/lib/completions/mmsitepass.exp b/test/lib/completions/mmsitepass.exp index 4dde214f..70d2a126 100644 --- a/test/lib/completions/mmsitepass.exp +++ b/test/lib/completions/mmsitepass.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -assert_complete_any "mmsitepass " +assert_complete_any "mmsitepass -" sync_after_int diff --git a/test/lib/completions/mock.exp b/test/lib/completions/mock.exp new file mode 100644 index 00000000..8190264a --- /dev/null +++ b/test/lib/completions/mock.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "mock " +sync_after_int + + +teardown diff --git a/test/lib/completions/modinfo.exp b/test/lib/completions/modinfo.exp index bd8f965c..90e9702a 100644 --- a/test/lib/completions/modinfo.exp +++ b/test/lib/completions/modinfo.exp @@ -11,8 +11,11 @@ proc teardown {} { setup -set test "in should complete modulename" -assert_complete_any "modinfo in" $test +set uname [exec bash -c "uname -r"] +if {[assert_exec "ls /lib/modules/$uname" "" "" "unsupported"]} { + set test "in should complete modulename" + assert_complete_any "modinfo in" $test +} sync_after_int diff --git a/test/lib/completions/modprobe.exp b/test/lib/completions/modprobe.exp index a1cd6987..b0a530ef 100644 --- a/test/lib/completions/modprobe.exp +++ b/test/lib/completions/modprobe.exp @@ -11,15 +11,18 @@ proc teardown {} { setup -set test "--remov should complete \"--remove\"" -assert_complete "--remove" "modprobe --remov" $test +set test "--al should complete \"--all\"" +assert_complete "--all" "modprobe --al" $test sync_after_int -set test "in should complete modulename" -assert_complete_any "modprobe in" $test +set uname [exec bash -c "uname -r"] +if {[assert_exec "ls /lib/modules/$uname" "" "" "unsupported"]} { + set test "in should complete modulename" + assert_complete_any "modprobe in" $test +} sync_after_int diff --git a/test/lib/completions/mount.exp b/test/lib/completions/mount.exp index 1298f36f..fea99b85 100644 --- a/test/lib/completions/mount.exp +++ b/test/lib/completions/mount.exp @@ -1,35 +1,9 @@ -# mount completion from fstab can't be tested directly because it -# (correctly) uses absolute paths. So we create a custom completion which -# reads from a file in our text fixture instead. -proc setup_dummy_mnt {} { - assert_bash_exec {unset COMPREPLY cur} - assert_bash_exec {unset -f _mnt} - - assert_bash_exec { \ - _mnt() { \ - local cur=$(_get_cword); \ - _linux_fstab $(_get_pword) < "$SRCDIRABS/fixtures/mount/test-fstab"; \ - }; \ - complete -F _mnt mnt \ - } -} - - -proc teardown_dummy_mnt {} { - assert_bash_exec {unset COMPREPLY cur} - assert_bash_exec {unset -f _mnt} - assert_bash_exec {complete -r mnt} -} - - proc setup {} { save_env - setup_dummy_mnt } proc teardown {} { - teardown_dummy_mnt assert_env_unmodified {/OLDPWD/d} } @@ -69,59 +43,4 @@ assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} sync_after_int -set test "Testing internal __linux_fstab_unescape function for mount" -# One round of slashes is for bash. -assert_bash_exec {var=one\'two\\040three\\} -assert_bash_exec {__linux_fstab_unescape var} -set cmd {echo $var} -send "$cmd\r" -expect { - -ex "$cmd\r\none'two three\\" { pass $test } -# default { fail $test } -} -sync_after_int -assert_bash_exec {unset var} - - -sync_after_int - - -# Begin testing through mnt (see setup_dummy_mnt). -assert_complete {/mnt/nice-test-path} {mnt /mnt/nice-test-p} -sync_after_int - -assert_complete {/mnt/nice\ test-path} {mnt /mnt/nice\ test-p} -sync_after_int - -assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$test-p} -sync_after_int - -assert_complete {/mnt/nice\ test\\path} {mnt /mnt/nice\ test\\p} -sync_after_int - -assert_complete {{/mnt/nice\ test\\path} {/mnt/nice\ test-path}} \ - {mnt /mnt/nice\ } "" -expect-cmd-minus {/mnt/nice\ } -sync_after_int - -assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$} -sync_after_int - -assert_complete {/mnt/nice\'test-path} {mnt /mnt/nice\'} -sync_after_int - -assert_complete {/mnt/other\'test\ path} {mnt /mnt/other} -sync_after_int - -assert_complete {Ubuntu\ Karmic} {mnt -L Ubu} -sync_after_int - -assert_complete {Debian-it\'s\ awesome} {mnt -L Deb} -sync_after_int - -# This does not work. Proper support for this requires smarter parsing of -# $COMP_LINE and it's not worth doing just for mount. -#assert_complete {$'/mnt/nice\ntest-path'} {mnt $'/mnt/nice\n} -#sync_after_int - - teardown diff --git a/test/lib/completions/mr.exp b/test/lib/completions/mr.exp new file mode 100644 index 00000000..d7d41bb6 --- /dev/null +++ b/test/lib/completions/mr.exp @@ -0,0 +1,46 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + +setup + +assert_complete_any "mr " +sync_after_int + +# Some versions require man to be around for useful output. +if {[assert_exec {man -h} "" "" "unsupported"]} { + + assert_complete_any "mr --" + sync_after_int + + assert_complete {"foo"} "mr -c $::srcdir/fixtures/shared/default/foo.d/" + sync_after_int + + assert_complete {"bar bar.d/" "foo.d/"} "mr -d $::srcdir/fixtures/shared/default/" + sync_after_int + + assert_complete {"bar" "bar bar.d/" "foo" "foo.d/"} "mr bootstrap $::srcdir/fixtures/shared/default/" + sync_after_int + + # Disabled for now; "clean" doesn't exist before mr 1.20141023 + #assert_complete "-f" "mr clean -" + #sync_after_int + + assert_complete "-m" "mr commit -" + sync_after_int + + assert_no_complete "mr status " + sync_after_int + + # Disabled temporarily: suggesting all commands produces too much output for + # test suite. + #assert_complete_any "mr run " + #sync_after_int +} + +teardown diff --git a/test/lib/completions/mysql.exp b/test/lib/completions/mysql.exp index 62a64fc2..b7a50b81 100644 --- a/test/lib/completions/mysql.exp +++ b/test/lib/completions/mysql.exp @@ -12,8 +12,10 @@ setup assert_complete_any "mysql --" +sync_after_int +assert_complete_any "mysql --default-character-set=" sync_after_int diff --git a/test/lib/completions/newgrp.exp b/test/lib/completions/newgrp.exp new file mode 100644 index 00000000..a5cddb8c --- /dev/null +++ b/test/lib/completions/newgrp.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "newgrp " +sync_after_int + + +teardown diff --git a/test/lib/completions/newlist.exp b/test/lib/completions/newlist.exp index 0696ec5e..dfabdc50 100644 --- a/test/lib/completions/newlist.exp +++ b/test/lib/completions/newlist.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -assert_complete_any "newlist " +assert_complete_any "newlist -" sync_after_int diff --git a/test/lib/completions/openssl.exp b/test/lib/completions/openssl.exp index d1357002..3adbbae7 100644 --- a/test/lib/completions/openssl.exp +++ b/test/lib/completions/openssl.exp @@ -28,5 +28,8 @@ sync_after_int assert_complete_any "openssl pkey -cipher " sync_after_int +assert_complete_any "openssl dgst -s" +sync_after_int + teardown diff --git a/test/lib/completions/optipng.exp b/test/lib/completions/optipng.exp new file mode 100644 index 00000000..0a079190 --- /dev/null +++ b/test/lib/completions/optipng.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "optipng " +sync_after_int + + +teardown diff --git a/test/lib/completions/pdftotext.exp b/test/lib/completions/pdftotext.exp new file mode 100644 index 00000000..4c5cfca5 --- /dev/null +++ b/test/lib/completions/pdftotext.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pdftotext " +sync_after_int + + +teardown diff --git a/test/lib/completions/perl.exp b/test/lib/completions/perl.exp index f3a51841..3a92a6b9 100644 --- a/test/lib/completions/perl.exp +++ b/test/lib/completions/perl.exp @@ -4,7 +4,7 @@ proc setup {} { proc teardown {} { - assert_env_unmodified + assert_env_unmodified {/PERL5LIB=/d} } @@ -117,4 +117,15 @@ sync_after_int assert_complete_any "perl -m-File::" sync_after_int +# Make sure at least our mock Devel::* module is around +assert_bash_exec {OLDPERL5LIB=$PERL5LIB; export PERL5LIB=$TESTDIR/fixtures/perl} + +assert_complete_any "perl -d:" +sync_after_int + +assert_complete_any "perl -dt:" +sync_after_int + +assert_bash_exec {export PERL5LIB=$OLDPERL5LIB; unset -v OLDPERL5LIB} + teardown diff --git a/test/lib/completions/perldoc.exp b/test/lib/completions/perldoc.exp index a745b55d..3197bf5c 100644 --- a/test/lib/completions/perldoc.exp +++ b/test/lib/completions/perldoc.exp @@ -1,4 +1,5 @@ proc setup {} { + assert_bash_exec {export PERL5LIB=$SRCDIR/fixtures/perldoc} save_env } @@ -31,4 +32,8 @@ assert_complete_any "perldoc -" sync_after_int +assert_complete "BashCompletionModule BashCompletionDoc" "perldoc BashCompletion" +sync_after_int + + teardown diff --git a/test/lib/completions/pine.exp b/test/lib/completions/pine.exp index 622bf064..9919a4cb 100644 --- a/test/lib/completions/pine.exp +++ b/test/lib/completions/pine.exp @@ -11,9 +11,7 @@ proc teardown {} { setup -assert_complete_any "pine " - - +assert_complete_any "pine -" sync_after_int diff --git a/test/lib/completions/pngfix.exp b/test/lib/completions/pngfix.exp new file mode 100644 index 00000000..d492610d --- /dev/null +++ b/test/lib/completions/pngfix.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pngfix " +sync_after_int + +assert_complete_any "pngfix -" +sync_after_int + + +teardown diff --git a/test/lib/completions/portsnap.exp b/test/lib/completions/portsnap.exp new file mode 100644 index 00000000..d6028cae --- /dev/null +++ b/test/lib/completions/portsnap.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "portsnap " +sync_after_int + + +teardown diff --git a/test/lib/completions/puppet.exp b/test/lib/completions/puppet.exp index 7b7da3e7..8b82a160 100644 --- a/test/lib/completions/puppet.exp +++ b/test/lib/completions/puppet.exp @@ -12,8 +12,9 @@ setup assert_complete_any "puppet " +sync_after_int - +assert_complete_any "puppet agent --" sync_after_int diff --git a/test/lib/completions/pushd.exp b/test/lib/completions/pushd.exp new file mode 100644 index 00000000..54e3ad8b --- /dev/null +++ b/test/lib/completions/pushd.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pushd " +sync_after_int + + +teardown diff --git a/test/lib/completions/py.test.exp b/test/lib/completions/py.test.exp new file mode 100644 index 00000000..736b9828 --- /dev/null +++ b/test/lib/completions/py.test.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "py.test " +sync_after_int + +assert_complete_any "py.test -" +sync_after_int + + +teardown diff --git a/test/lib/completions/pyflakes.exp b/test/lib/completions/pyflakes.exp new file mode 100644 index 00000000..22a8cf7c --- /dev/null +++ b/test/lib/completions/pyflakes.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pyflakes " +sync_after_int + + +teardown diff --git a/test/lib/completions/python.exp b/test/lib/completions/python.exp index 446e3d09..29a10bf6 100644 --- a/test/lib/completions/python.exp +++ b/test/lib/completions/python.exp @@ -17,5 +17,29 @@ sync_after_int assert_complete_any "python -" sync_after_int +assert_no_complete "python -c " +sync_after_int + +assert_complete {"bar bar.d/" foo.d/} "python $::srcdir/fixtures/shared/default/" +sync_after_int + +assert_complete {bar "bar bar.d/" foo foo.d/} "python -c foo $::srcdir/fixtures/shared/default/" +sync_after_int + +assert_no_complete "python -c foo -" +sync_after_int + +assert_no_complete "python -m foo -" +sync_after_int + +assert_complete_any "python -m sy" +sync_after_int + +assert_complete_any "python -W " +sync_after_int + +assert_complete_any "python -Wa" +sync_after_int + teardown diff --git a/test/lib/completions/pyvenv.exp b/test/lib/completions/pyvenv.exp new file mode 100644 index 00000000..9eca0e4c --- /dev/null +++ b/test/lib/completions/pyvenv.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pyvenv " +sync_after_int + + +teardown diff --git a/test/lib/completions/quotacheck.exp b/test/lib/completions/quotacheck.exp index 4200da32..353d204a 100644 --- a/test/lib/completions/quotacheck.exp +++ b/test/lib/completions/quotacheck.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -assert_complete_any "quotacheck " +assert_complete_any "quotacheck -" sync_after_int diff --git a/test/lib/completions/quotaon.exp b/test/lib/completions/quotaon.exp index 4acc70e1..b8279e59 100644 --- a/test/lib/completions/quotaon.exp +++ b/test/lib/completions/quotaon.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -assert_complete_any "quotaon " +assert_complete_any "quotaon -" sync_after_int diff --git a/test/lib/completions/renice.exp b/test/lib/completions/renice.exp index fdc859b4..5e25ddea 100644 --- a/test/lib/completions/renice.exp +++ b/test/lib/completions/renice.exp @@ -11,32 +11,15 @@ proc teardown {} { setup -set test "Tab should show complete process ids" - # Try completion -set cmd "renice 1" -send "$cmd\t" -expect { - -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" } - -re /@ { unresolved "$test at prompt" } - -re eof { unresolved "eof" } -} - +if {[assert_bash_type ps]} { -sync_after_int + assert_complete_any "renice 1" + sync_after_int + assert_complete_any "renice -g " + sync_after_int -set test "Tab should show complete process group ids" - # Try completion -set cmd "renice -g " -send "$cmd\t" -expect { - -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" } - -re /@ { unresolved "$test at prompt" } - -re eof { unresolved "eof" } } -sync_after_int - - teardown diff --git a/test/lib/completions/repomanage.exp b/test/lib/completions/repomanage.exp new file mode 100644 index 00000000..de5169bc --- /dev/null +++ b/test/lib/completions/repomanage.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "repomanage " +sync_after_int + + +teardown diff --git a/test/lib/completions/ri.exp b/test/lib/completions/ri.exp index e6661d1b..1210685b 100644 --- a/test/lib/completions/ri.exp +++ b/test/lib/completions/ri.exp @@ -1,19 +1,25 @@ proc setup {} { + assert_bash_exec {OLDRI="$RI"; export RI="-d $SRCDIR/fixtures/ri"} save_env } proc teardown {} { assert_env_unmodified + assert_bash_exec {RI="$OLDRI"; unset -v OLDRI} } setup -assert_complete_any "ri RI" +assert_complete_any "ri -" +sync_after_int +assert_complete "BashCompletion/ cache.ri" "ri --dump=$::srcdir/fixtures/ri/" +sync_after_int +assert_complete "BashCompletion" "ri BashCompletio" sync_after_int diff --git a/test/lib/completions/rsync.exp b/test/lib/completions/rsync.exp index 42b7af8e..accc6569 100644 --- a/test/lib/completions/rsync.exp +++ b/test/lib/completions/rsync.exp @@ -4,7 +4,9 @@ proc setup {} { proc teardown {} { - assert_env_unmodified + assert_env_unmodified { + /_scp_path_esc=/d + } } diff --git a/test/lib/completions/rtcwake.exp b/test/lib/completions/rtcwake.exp index 21c05eab..81ca3206 100644 --- a/test/lib/completions/rtcwake.exp +++ b/test/lib/completions/rtcwake.exp @@ -12,8 +12,6 @@ setup assert_complete_any "rtcwake " - - sync_after_int diff --git a/test/lib/completions/scp.exp b/test/lib/completions/scp.exp index 7cc6eb07..6b06cb25 100644 --- a/test/lib/completions/scp.exp +++ b/test/lib/completions/scp.exp @@ -55,13 +55,13 @@ set test "Tab should complete known-hosts" # Build string list of expected completions # Get hostnames and give them a colon (:) suffix - # Hosts `gee' and `hus' are defined in ./fixtures/scp/config + # Hosts `gee' and `hut' are defined in ./fixtures/scp/config # Hosts `blah', `doo' and `ike' are defined in ./fixtures/scp/known_hosts set expected {} foreach host [get_hosts] { lappend expected "$host:" } -lappend expected blah: doo: gee: hus: ike: +lappend expected blah: doo: gee: hut: ike: # Append local filenames lappend expected config known_hosts "spaced\\ \\ conf" assert_complete $expected "scp -F config " $test diff --git a/test/lib/completions/screen.exp b/test/lib/completions/screen.exp index 5e585179..f37d5f5f 100644 --- a/test/lib/completions/screen.exp +++ b/test/lib/completions/screen.exp @@ -24,6 +24,10 @@ assert_complete_any "screen cat" sync_after_int +assert_complete_any "screen -T " +sync_after_int + + assert_complete_any "screen -T foo cat" sync_after_int diff --git a/test/lib/completions/sftp.exp b/test/lib/completions/sftp.exp index 27fe7511..3c18ddb7 100644 --- a/test/lib/completions/sftp.exp +++ b/test/lib/completions/sftp.exp @@ -21,9 +21,9 @@ setup # Build string list of expected completions set expected [get_hosts] - # Hosts `gee' and `hus' are defined in ./fixtures/sftp/config + # Hosts `gee' and `hut' are defined in ./fixtures/sftp/config # Hosts `10.10.10.10', `doo' and `ike' are defined in ./fixtures/sftp/known_hosts -lappend expected 10.10.10.10 doo gee hus ike +lappend expected 10.10.10.10 doo gee hut ike assert_complete $expected "sftp -F config " @@ -48,9 +48,9 @@ sync_after_int # Build string list of expected completions # Get hostnames and give them a colon (:) suffix set expected [get_hosts] - # Hosts `gee', `hus' and `jar' are defined in "./fixtures/sftp/spaced conf" + # Hosts `gee' and `jar' are defined in "./fixtures/sftp/spaced conf" # Hosts `10.10.10.10', `doo' and `ike' are defined in ./fixtures/sftp/known_hosts -lappend expected 10.10.10.10 doo gee hus ike jar +lappend expected 10.10.10.10 doo gee ike jar assert_complete $expected "sftp -F spaced\\ \\ conf " diff --git a/test/lib/completions/ssh-copy-id.exp b/test/lib/completions/ssh-copy-id.exp index e8b643fd..5abe303d 100644 --- a/test/lib/completions/ssh-copy-id.exp +++ b/test/lib/completions/ssh-copy-id.exp @@ -1,10 +1,16 @@ proc setup {} { save_env + # Some old versions of ssh-copy-id won't output even usage if no + # identities are found. Try to make sure there is at least one (for CI). + assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIR/fixtures/ssh-copy-id} } proc teardown {} { - assert_env_unmodified + assert_bash_exec {HOME=$OLDHOME} + assert_env_unmodified { + /OLDHOME=/d + } } diff --git a/test/lib/completions/ssh-keygen.exp b/test/lib/completions/ssh-keygen.exp new file mode 100644 index 00000000..fea2529e --- /dev/null +++ b/test/lib/completions/ssh-keygen.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "ssh-keygen -" +sync_after_int + + +teardown diff --git a/test/lib/completions/ssh.exp b/test/lib/completions/ssh.exp index 3ef0bb69..c082558e 100644 --- a/test/lib/completions/ssh.exp +++ b/test/lib/completions/ssh.exp @@ -60,7 +60,23 @@ sync_after_int set test "First argument should complete partial hostname" -assert_complete_partial [get_known_hosts] ssh "l" $test -ltrim-colon-completions +# Build string list of hostnames, starting with the character of the first +# host, unless host starts with a COMP_WORDBREAKS character, e.g. a colon (:). +# Hosts starting with a COMP_WORDBREAKS character are left out because these +# are exceptional cases, requiring specific tests. +set hosts {} +set char "" +foreach h [get_known_hosts] { + set first [string range $h 0 0] + if {$char == "" && [string first $first $::COMP_WORDBREAKS] == -1} {set char $first} + if {$char != ""} { + # Only append unique hostnames starting with $char + if {$first == $char && [lsearch -exact $hosts "$h"] == -1} { + lappend hosts "$h" + } + } +} +assert_complete $hosts "ssh $char" $test -ltrim-colon-completions -expect-cmd-minus "$char" sync_after_int diff --git a/test/lib/completions/synclient.exp b/test/lib/completions/synclient.exp new file mode 100644 index 00000000..1e9c7b5b --- /dev/null +++ b/test/lib/completions/synclient.exp @@ -0,0 +1,26 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "synclient -" +sync_after_int + + +# synclient -l may error out with e.g. +# Couldn't find synaptics properties. No synaptics driver loaded? +if {[assert_exec {synclient -l} "" "" "unsupported"]} { + assert_complete_any "synclient " +} +sync_after_int + + +teardown diff --git a/test/lib/completions/tar.exp b/test/lib/completions/tar.exp index 37f1ae4b..75434e94 100644 --- a/test/lib/completions/tar.exp +++ b/test/lib/completions/tar.exp @@ -2,19 +2,131 @@ proc setup {} { save_env } - proc teardown {} { - assert_env_unmodified + assert_env_unmodified { + /OLDPWD=/d + /declare -f _tar/d + } } - setup +# Detect whether system's tar is GNU tar +set cmd "tar --version" +send "$cmd\r" +expect "^$cmd\r\n" +expect { + -re "GNU\[^\n\]*\n" { + set tar_version gnu + } + -re ".*\n" { + set tar_version unknown + } +} +sync_after_int + +set test "old option: list escaped chars" +assert_complete_dir "a/b\\'c/" "tar tf escape.tar a/b\\\'" $::srcdir/fixtures/tar $test +sync_after_int + +# TODO: "tar tf escape.tar a/b" + +set test "check that any completion done" assert_complete_any "tar " +sync_after_int + +# Use bsdtar as the it completes to only 'zc zt zx' ('tar' can be GNU tar and it +# can would have more options) +set test "old option: mode is not on first place" +assert_complete {zc zt zx} "bsdtar z" $test +sync_after_int + +set test "old option: test 'f' when mode is not as a first option" +assert_complete_dir "dir/ dir2/" "tar zfc " $::srcdir/fixtures/tar +sync_after_int + +set test "old option: creating archive and 'f' option" +assert_complete_dir "dir/ dir2/" "tar cf " $::srcdir/fixtures/tar +sync_after_int + +set test "old option: archive listing" +assert_complete_dir "dir/fileA dir/fileB dir/fileC" "tar tf archive.tar.xz dir/file" $::srcdir/fixtures/tar +sync_after_int +set test "old option: check _second_ option in \"old\" argument" +assert_complete_dir "dir/ dir2/" "bsdtar cbfvv NOT_EXISTS " $::srcdir/fixtures/tar +sync_after_int + +set test "old option: create and members" +assert_complete_dir "dir/ dir2/ archive.tar.xz escape.tar" "tar cTfvv NOT_EXISTS DONT_CREATE.tar " $::srcdir/fixtures/tar +sync_after_int +set test "old option: extract and archive" +assert_complete_dir "dir/ dir2/ archive.tar.xz escape.tar" "tar xvf " $::srcdir/fixtures/tar sync_after_int +if { "$tar_version" == "gnu" } { + set test "check short options" + assert_complete_any "tar -c" + sync_after_int + + set test "mode not as a first option" + assert_complete_dir "dir/ dir2/" "tar -zcf " $::srcdir/fixtures/tar + sync_after_int + + # Only directories should be completed. + set test "check that we do not suggest re-writing existing archive" + assert_complete_dir "dir/ dir2/" "tar -cf " $::srcdir/fixtures/tar + sync_after_int + + set test "check --file option" + assert_complete_dir "dir/ dir2/" "tar -c --file " $::srcdir/fixtures/tar + sync_after_int + + set test "check --file option #2" + assert_complete_dir "dir/ dir2/" "tar -cvv --file " $::srcdir/fixtures/tar + sync_after_int + + set test "archive listing" + assert_complete_dir "dir/fileA dir/fileB dir/fileC" "tar -tf archive.tar.xz dir/file" $::srcdir/fixtures/tar + sync_after_int + + set test "archive listing with --file" + assert_complete_dir "dir/fileA dir/fileB dir/fileC" "tar -t --file archive.tar.xz dir/file" $::srcdir/fixtures/tar + sync_after_int + + # Some random options should work: + set test "test random tar's long option #1" + assert_complete "--blocking-factor= --block-number" "tar --block" $test + sync_after_int + + set test "test random tar's long option #2" + assert_complete "--add-file=" "tar --add-fil" $test -nospace + sync_after_int + + set test "test random tar's long option #3" + assert_complete "--posix" "tar -cf /dev/null --posi" $test + sync_after_int + + # --owner + set users [exec bash -c "compgen -A user"] + set test "test --owner option" + assert_complete $users "tar --owner=" $test + sync_after_int + + # --group + set groups [exec bash -c "compgen -A group"] + set test "test --group option" + assert_complete $groups "tar --group=" $test + sync_after_int + + # use -b for this as -b is still not handled by tar's completion + set test "short opt -XXXb (arg required)" + assert_no_complete "tar -cvvfb " $test + sync_after_int + + # TODO: how to test that 'tar -cf' completes to 'tar -cf ' +} teardown diff --git a/test/lib/completions/timeout.exp b/test/lib/completions/timeout.exp new file mode 100644 index 00000000..f56c80f3 --- /dev/null +++ b/test/lib/completions/timeout.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "timeout -" +sync_after_int + +assert_no_complete "timeout " "1st non-option arg=timeout, shouldn't complete" +sync_after_int + + +teardown diff --git a/test/lib/completions/tipc.exp b/test/lib/completions/tipc.exp new file mode 100644 index 00000000..dd88de31 --- /dev/null +++ b/test/lib/completions/tipc.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "tipc " +sync_after_int + + +teardown diff --git a/test/lib/completions/udevadm.exp b/test/lib/completions/udevadm.exp new file mode 100644 index 00000000..87a948a8 --- /dev/null +++ b/test/lib/completions/udevadm.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "udevadm " +sync_after_int + + +teardown diff --git a/test/lib/completions/umount.exp b/test/lib/completions/umount.exp index 21a2dfa5..e7703d12 100644 --- a/test/lib/completions/umount.exp +++ b/test/lib/completions/umount.exp @@ -1,10 +1,36 @@ +# umount completion from fstab can't be tested directly because it +# (correctly) uses absolute paths. So we create a custom completion which +# reads from a file in our text fixture instead. +proc setup_dummy_mnt {} { + assert_bash_exec {unset COMPREPLY cur} + assert_bash_exec {unset -f _mnt} + + assert_bash_exec { \ + _mnt() { \ + local cur=$(_get_cword); \ + _linux_fstab $(_get_pword) < "$SRCDIRABS/fixtures/mount/test-fstab"; \ + }; \ + complete -F _mnt mnt \ + } +} + + +proc teardown_dummy_mnt {} { + assert_bash_exec {unset COMPREPLY cur} + assert_bash_exec {unset -f _mnt} + assert_bash_exec {complete -r mnt} +} + + proc setup {} { save_env + setup_dummy_mnt } proc teardown {} { - assert_env_unmodified + teardown_dummy_mnt + assert_env_unmodified {/OLDPWD/d} } @@ -17,4 +43,59 @@ assert_complete_any "umount " sync_after_int +set test "Testing internal __linux_fstab_unescape function for umount" +# One round of slashes is for bash. +assert_bash_exec {var=one\'two\\040three\\} +assert_bash_exec {__linux_fstab_unescape var} +set cmd {echo $var} +send "$cmd\r" +expect { + -ex "$cmd\r\none'two three\\" { pass $test } +# default { fail $test } +} +sync_after_int +assert_bash_exec {unset var} + + +sync_after_int + + +# Begin testing through mnt (see setup_dummy_mnt). +assert_complete {/mnt/nice-test-path} {mnt /mnt/nice-test-p} +sync_after_int + +assert_complete {/mnt/nice\ test-path} {mnt /mnt/nice\ test-p} +sync_after_int + +assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$test-p} +sync_after_int + +assert_complete {/mnt/nice\ test\\path} {mnt /mnt/nice\ test\\p} +sync_after_int + +assert_complete {{/mnt/nice\ test\\path} {/mnt/nice\ test-path}} \ + {mnt /mnt/nice\ } "" -expect-cmd-minus {/mnt/nice\ } +sync_after_int + +assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$} +sync_after_int + +assert_complete {/mnt/nice\'test-path} {mnt /mnt/nice\'} +sync_after_int + +assert_complete {/mnt/other\'test\ path} {mnt /mnt/other} +sync_after_int + +assert_complete {Ubuntu\ Karmic} {mnt -L Ubu} +sync_after_int + +assert_complete {Debian-it\'s\ awesome} {mnt -L Deb} +sync_after_int + +# This does not work. Proper support for this requires smarter parsing of +# $COMP_LINE and it's not worth doing just for umount. +#assert_complete {$'/mnt/nice\ntest-path'} {mnt $'/mnt/nice\n} +#sync_after_int + + teardown diff --git a/test/lib/completions/unshunt.exp b/test/lib/completions/unshunt.exp index 96cd5860..cac4ce65 100644 --- a/test/lib/completions/unshunt.exp +++ b/test/lib/completions/unshunt.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -assert_complete_any "unshunt -" +assert_complete_any "unshunt --" sync_after_int diff --git a/test/lib/completions/vgcreate.exp b/test/lib/completions/vgcreate.exp index 4cb7dd45..6f3b3e37 100644 --- a/test/lib/completions/vgcreate.exp +++ b/test/lib/completions/vgcreate.exp @@ -12,8 +12,10 @@ setup assert_complete_any "vgcreate -" +sync_after_int +assert_no_complete "vgcreate __does_not_exist__" sync_after_int diff --git a/test/lib/completions/wtf.exp b/test/lib/completions/wtf.exp index b1693c80..0080967c 100644 --- a/test/lib/completions/wtf.exp +++ b/test/lib/completions/wtf.exp @@ -11,7 +11,7 @@ proc teardown {} { setup -assert_complete_any "wtf " +assert_complete_any "wtf A" sync_after_int diff --git a/test/lib/completions/zopfli.exp b/test/lib/completions/zopfli.exp new file mode 100644 index 00000000..15738ff0 --- /dev/null +++ b/test/lib/completions/zopfli.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "zopfli " +sync_after_int + + +teardown diff --git a/test/lib/completions/zopflipng.exp b/test/lib/completions/zopflipng.exp new file mode 100644 index 00000000..9c421a14 --- /dev/null +++ b/test/lib/completions/zopflipng.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "zopflipng " +sync_after_int + + +teardown diff --git a/test/lib/library.exp b/test/lib/library.exp index 75bf921c..1e2c7456 100644 --- a/test/lib/library.exp +++ b/test/lib/library.exp @@ -10,7 +10,7 @@ package require textutil::string # Execute a bash command and make sure the exit status is successful. # If not, output the error message. # @param string $cmd Bash command line to execute. If empty string (""), the -# exit status of the previously executed bash command will be +# exit status of the previously executed bash command will be # checked; specify `title' to adorn the error message. # @param string $title (optional) Command title. If empty, `cmd' is used. # @param string $prompt (optional) Bash prompt. Default is "/@" @@ -51,7 +51,7 @@ proc assert_bash_exec {{aCmd ""} {title ""} {prompt /@} {out -1}} { # @param string $command Command to locate proc assert_bash_type {command} { set test "$command should be available in bash" - set cmd "type $command &> /dev/null && echo -n 0 || echo -n 1" + set cmd "type $command &> /dev/null && echo -n 0 || echo -n 1" send "$cmd\r" expect "$cmd\r\n" expect { @@ -74,7 +74,7 @@ proc assert_bash_type {command} { # @param list $args Options: # -sort Compare list sorted. Default is unsorted # -prompt Bash prompt. Default is `/@' -# -chunk-size N Compare list N items at a time. Default +# -chunk-size N Compare list N items at a time. Default # is 20. proc assert_bash_list {expected cmd test {args {}}} { array set arg [::cmdline::getoptions args { @@ -114,7 +114,7 @@ proc assert_bash_list {expected cmd test {args {}}} { # @param list $args Options: # -sort Compare list sorted. Default is unsorted # -prompt Bash prompt. Default is `/@' -# -chunk-size N Compare list N items at a time. Default +# -chunk-size N Compare list N items at a time. Default # is 20. proc assert_bash_list_dir {expected cmd dir test {args {}}} { array set arg [::cmdline::getoptions args { @@ -126,7 +126,7 @@ proc assert_bash_list_dir {expected cmd dir test {args {}}} { if {$arg(sort)} {set arg_sort "-sort"} else {set arg_sort ""} assert_bash_exec "cd $dir" "" $prompt assert_bash_list $expected $cmd $test $arg_sort \ - -chunk-size $arg(chunk-size) -prompt $prompt + -chunk-size $arg(chunk-size) -prompt $prompt sync_after_int $prompt assert_bash_exec {cd "$TESTDIR"} } @@ -253,10 +253,12 @@ proc assert_complete_one {expected cmd {test ""} {args {}}} { if {$test == ""} {set test "$cmd should show completion"} send "$cmd\t" expect -ex "$cmd" + set trimmed false if {$arg(ltrim-colon-completions)} { # If partial contains colon (:), remove partial from begin of items - _ltrim_colon_completions $cmd expected cword - } else { + set trimmed [_ltrim_colon_completions $cmd expected cword] + } + if {! $trimmed} { set cur ""; # Default to empty word to complete on set words [split_words_bash $cmd] if {[llength $words] > 1} { @@ -346,7 +348,7 @@ proc assert_complete_any {cmd {test ""} {prompt /@}} { expect { # Match completion, single word. This word is shown on the # same line as the command. - -re "^\\w+ $" { pass "$test" } + -re "^\\S* $" { pass "$test" } # Try matching multiple words again, with new timeout -re "^\r\n.*$prompt$cmd\\S*$" { pass "$test" } } @@ -373,7 +375,7 @@ proc assert_complete_dir {expected cmd dir {test ""} {args {}}} { sync_after_int $prompt assert_bash_exec {cd "$TESTDIR"} } - + # Make sure a partial argument is completed. @@ -408,7 +410,7 @@ proc assert_complete_partial {expected cmd {partial ""} {test ""} {args {}}} { # If cword contains colon (:), left-trim completions with cword -# @param string $cmd Command to complete +# @param string $cmd Command to complete # @param list $items Reference to list of completions to trim # @param string $dword Reference to variable to contain word to remove from # expected cmd. @@ -437,7 +439,9 @@ proc _ltrim_colon_completions {cmd items dword} { lset items_out $i [string range $item [string length $cur] end] } } + return true } + return false } @@ -445,13 +449,13 @@ proc _ltrim_colon_completions {cmd items dword} { # to `save_env()'. # @param string $sed Sed commands to preprocess diff output. # Example calls: -# +# # # Replace `COMP_PATH=.*' with `COMP_PATH=PATH' # assert_env_unmodified {s/COMP_PATH=.*/COMP_PATH=PATH/} -# +# # # Remove lines containing `OLDPWD=' # assert_env_unmodified {/OLDPWD=/d} -# +# # @param string $file Filename to generate environment save file from. See # `gen_env_filename()'. # @param string $diff Expected diff output (after being processed by $sed) @@ -488,8 +492,8 @@ proc assert_env_unmodified {{sed ""} {file ""} {diff ""}} { expect { -re "^$diff[wd]@$" { pass "$test" } - -re [wd]@ { - fail "$test" + -re [wd]@ { + fail "$test" # Show diff to user @@ -587,7 +591,7 @@ proc assert_no_output {{cmd} {test ""} {prompt /@}} { # "lib/completions/$cmd.exp". proc assert_source_completions {command {file ""}} { if {[assert_bash_type $command] - && [is_bash_completion_installed_for $command]} { + && [assert_install_completion_for $command]} { if {[string length $file] == 0} { set file "$::srcdir/lib/completions/$command.exp" } @@ -598,6 +602,21 @@ proc assert_source_completions {command {file ""}} { } +# Assert that a _filedir_xspec completion is installed for specified command +# @param string $command Command to check completion installation for. +proc assert_xspec_completion_installed {command} { + set test "Completion via _filedir_xspec() should be installed" + set cmd "complete -p $command" + send "$cmd\r" + + set expected "^$cmd\r\ncomplete -F _filedir_xspec $command\r\n/@$" + expect { + -re $expected { pass "$test" } + -re /@ { fail "$test at prompt" } + } +} + + # Sort list. # `exec sort' is used instead of `lsort' to achieve exactly the # same sort order as in bash. @@ -690,13 +709,12 @@ proc init_tcl_bash_globals {} { } -# Check whether completion is installed for the specified command by executing -# `complete -p ...' in bash. -# @param string $command Command to check completion availability for. +# Try installing completion for the specified command. +# @param string $command Command to install completion for. # @return boolean True (1) if completion is installed, False (0) if not. -proc is_bash_completion_installed_for {command} { +proc assert_install_completion_for {command} { set test "$command should have completion installed in bash" - set cmd "complete -p $command &> /dev/null && echo -n 0 || echo -n 1" + set cmd "__load_completion $command ; complete -p $command &> /dev/null && echo -n 0 || echo -n 1" send "$cmd\r" expect "$cmd\r\n" expect { @@ -716,7 +734,7 @@ proc is_cygwin {} { # Expect items, a limited number (20) at a time. # Break items into chunks because `expect' seems to have a limited buffer size -# @param list $items Expected list items +# @param list $items Expected list items # @param list $args Options: # -bash-sort Compare list bash-sorted. Default is # unsorted @@ -846,13 +864,13 @@ proc save_env {{file ""}} { # @param string File to save the environment to. Default is "$TESTDIR/tmp/env1~". # @see assert_env_unmodified() proc _save_env {{file ""}} { - assert_bash_exec "{ set; declare -F; shopt -p; } > \"$file\"" + assert_bash_exec "{ (set -o posix ; set); declare -F; shopt -p; set -o; } > \"$file\"" } # Source bash_completion package proc source_bash_completion {} { - assert_bash_exec {BASH_COMPLETION_COMPAT_DIR=$(cd "$SRCDIR/.."; pwd)/completions} + assert_bash_exec {BASH_COMPLETION_COMPAT_DIR="$SRCDIR/fixtures/shared/empty_dir"} assert_bash_exec {source $(cd "$SRCDIR/.."; pwd)/bash_completion} } @@ -994,7 +1012,7 @@ proc init_bash_xtrace {{fname xtrace.log}} { # Setup test environment -# +# # Common initialization for unit and completion tests. proc start_interactive_test {} { start_bash diff --git a/test/lib/library.sh b/test/lib/library.sh index 290ec813..0a671595 100644 --- a/test/lib/library.sh +++ b/test/lib/library.sh @@ -24,6 +24,8 @@ diff_env() { /[<>] PPID=/d # Remove BASH_REMATCH bash variable /[<>] BASH_REMATCH=/d +# Remove functions starting with underscore + /[<>] declare -f _/d $3" } # diff_env() @@ -62,12 +64,3 @@ is_bash_version_minimal() { remove_comp_wordbreak_char() { COMP_WORDBREAKS=${COMP_WORDBREAKS//$1} } # remove_comp_wordbreak_char() - - -# Local variables: -# mode: shell-script -# sh-basic-offset: 4 -# sh-indent-comment: t -# indent-tabs-mode: nil -# End: -# ex: ts=4 sw=4 et filetype=sh diff --git a/test/log/.gitignore b/test/log/.gitignore new file mode 100644 index 00000000..72e8ffc0 --- /dev/null +++ b/test/log/.gitignore @@ -0,0 +1 @@ +* diff --git a/test/run b/test/run new file mode 100755 index 00000000..43651654 --- /dev/null +++ b/test/run @@ -0,0 +1,63 @@ +#!/bin/bash + + +# Print some helpful messages. +usage() { + echo "Run bash-completion tests" + echo + echo "The 'tool' is determined automatically from filenames." + echo "Unrecognized options are passed through to dejagnu by default." + echo + echo "Interesting options:" + echo " --tool_exec= Test against a different bash executable." + echo " --debug Create a dbg.log in the test directory with detailed expect match information." + echo " --timeout Change expect timeout from the default of 10 seconds." + echo " --debug-xtrace Create an xtrace.log in the test directory with set -x output." + echo + echo "Example run: ./run unit/_get_cword.exp unit/compgen.exp" +} + + +# Try to set the tool variable; or fail if trying to set different values. +set_tool() { + if [[ $tool ]]; then + if [[ $tool != $1 ]]; then + echo "Tool spec mismatch ('$tool' and '$1'). See --usage." + exit 1 + fi + else + tool=$1 + fi +} + + +cd "$(dirname "${BASH_SOURCE[0]}")" + + +# Loop over the arguments. +args=() +while [[ $# > 0 ]]; do + case "$1" in + --help|--usage) usage; exit 1;; + --debug-xtrace) args+=(OPT_BASH_XTRACE=1);; + --timeout) shift; timeout=$1;; + --timeout=*) timeout=${1/--timeout=};; + --tool=*) set_tool "${1#/--tool=}";; + --tool) shift; set_tool "$1";; + completion/*.exp|*/completion/*.exp|unit/*.exp|*/unit/*.exp) + arg=${1%/*} + set_tool "${arg##*/}" + args+=("${1##*/}") + ;; + *) args+=("$1") + esac + shift +done + +[[ -n $timeout ]] && args+=("OPT_TIMEOUT=$timeout") +[[ -z $tool ]] && { echo "Must specify tool somehow"; exit 1; } + +runtest --outdir log --tool $tool "${args[@]}" +rc=$? +[[ $rc -ne 0 && -n "$CI" ]] && cat log/$tool.log +exit $rc diff --git a/test/runCompletion b/test/runCompletion new file mode 100755 index 00000000..38a82622 --- /dev/null +++ b/test/runCompletion @@ -0,0 +1,8 @@ +#!/bin/bash + +# NOTE: I tried setting up bash_completion_lib within ./lib files, but DejaGnu +# isn't initialized at that point (i.e. output of `expect' is shown on +# stdout - `open_logs' hasn't run yet?). And running code from a library +# file isn't probably a good idea either. +exec "${bashcomp_bash:-$BASH}" \ + "$(dirname "${BASH_SOURCE[0]}")/run" --tool completion $* diff --git a/test/runInstall b/test/runInstall new file mode 100755 index 00000000..87aea589 --- /dev/null +++ b/test/runInstall @@ -0,0 +1,7 @@ +#!/bin/bash + +# NOTE: I tried setting up bash_completion_lib within ./lib files, but DejaGnu +# isn't initialized at that point (i.e. output of `expect' is shown on +# stdout - `open_logs' hasn't run yet?). And running code from a library +# file isn't probably a good idea either. +exec runtest --outdir log --tool install $* diff --git a/test/runLint b/test/runLint new file mode 100755 index 00000000..2db8f358 --- /dev/null +++ b/test/runLint @@ -0,0 +1,45 @@ +#!/bin/bash + +gitgrep() +{ + local out=$(git grep -I -P -n "$1" | \ + grep -E '^(bash_completion|completions/|test/)' | \ + grep -Fv 'test/runLint') + if [ -n "$out" ] ; then + printf '***** %s\n' "$2" + printf '%s\n\n' "$out" + fi +} + +unset CDPATH +cd $(dirname "$0") ; cd .. + +cmdstart='(^|[[:space:]]|\()' + +gitgrep $cmdstart"awk\b.*-F([[:space:]]|[[:space:]]*[\"'][^\"']{2,})" \ + 'awk with -F char or -F ERE, use -Fchar instead (Solaris)' + +gitgrep $cmdstart"awk\b.*\[:[a-z]*:\]" \ + 'awk with POSIX character class not supported in mawk (Debian/Ubuntu)' + +gitgrep $cmdstart'sed\b.*\\[?+]' \ + 'sed with ? or +, use POSIX BRE instead (\{m,n\})' + +gitgrep $cmdstart'sed\b.*\\\|' \ + "sed with \|, use POSIX BRE (possibly multiple sed invocations) or another tool instead" + +# TODO: really nonportable? appears to work fine in Linux, FreeBSD, Solaris +#gitgrep $cmdstart'sed\b.*;' \ +# 'sed with ;, use multiple -e options instead (POSIX?) (false positives?)' + +gitgrep $cmdstart'sed\b.*-[^[:space:]]*[rE]' \ + 'sed with -r or -E, drop and use POSIX BRE instead' + +gitgrep $cmdstart'[ef]grep\b' \ + '[ef]grep, use grep -[EF] instead (historical/deprecated)' + +# TODO: $ in sed subexpression used as an anchor (POSIX BRE optional, not in +# Solaris/FreeBSD) + +gitgrep '(?