summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Paleino <dapal@debian.org>2011-11-03 12:32:52 +0100
committerDavid Paleino <dapal@debian.org>2011-11-03 12:32:52 +0100
commit2c8171c38d87ddef31c92a76547d3fdf773a1337 (patch)
tree5e720d5a06ead72ed55454bf6647a712a761ed91 /test
parent9920a8faedf704420571d8072ccab27e9dac40ba (diff)
downloadbash-completion-2c8171c38d87ddef31c92a76547d3fdf773a1337.tar.gz
Imported Upstream version 1.90upstream/1.90
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.in4
-rw-r--r--test/completion/a2x.exp1
-rw-r--r--test/completion/arping.exp1
-rw-r--r--test/completion/asciidoc.exp1
-rw-r--r--test/completion/avctrl.exp1
-rw-r--r--test/completion/base64.exp1
-rw-r--r--test/completion/cal.exp1
-rw-r--r--test/completion/cfagent.exp1
-rw-r--r--test/completion/chage.exp1
-rw-r--r--test/completion/chpasswd.exp1
-rw-r--r--test/completion/chrpath.exp1
-rw-r--r--test/completion/ciptool.exp1
-rw-r--r--test/completion/compare.exp1
-rw-r--r--test/completion/conjure.exp1
-rw-r--r--test/completion/cppcheck.exp1
-rw-r--r--test/completion/curl.exp1
-rw-r--r--test/completion/dfutool.exp1
-rw-r--r--test/completion/dmesg.exp1
-rw-r--r--test/completion/dot.exp1
-rw-r--r--test/completion/explodepkg.exp1
-rw-r--r--test/completion/faillog.exp1
-rw-r--r--test/completion/fbgs.exp1
-rw-r--r--test/completion/fbi.exp1
-rw-r--r--test/completion/feh.exp1
-rw-r--r--test/completion/file.exp1
-rw-r--r--test/completion/fusermount.exp1
-rw-r--r--test/completion/gendiff.exp1
-rw-r--r--test/completion/gnome-mplayer.exp1
-rw-r--r--test/completion/gpasswd.exp1
-rw-r--r--test/completion/grpck.exp1
-rw-r--r--test/completion/hciattach.exp1
-rw-r--r--test/completion/hciconfig.exp1
-rw-r--r--test/completion/hddtemp.exp1
-rw-r--r--test/completion/host.exp1
-rw-r--r--test/completion/htpasswd.exp1
-rw-r--r--test/completion/idn.exp1
-rw-r--r--test/completion/import.exp1
-rw-r--r--test/completion/installpkg.exp1
-rw-r--r--test/completion/ionice.exp1
-rw-r--r--test/completion/jps.exp1
-rw-r--r--test/completion/kcov.exp1
-rw-r--r--test/completion/l2ping.exp1
-rw-r--r--test/completion/lastlog.exp1
-rw-r--r--test/completion/ldapadd.exp1
-rw-r--r--test/completion/ldapcompare.exp1
-rw-r--r--test/completion/ldapdelete.exp1
-rw-r--r--test/completion/ldapmodrdn.exp1
-rw-r--r--test/completion/ldappasswd.exp1
-rw-r--r--test/completion/ldapsearch.exp1
-rw-r--r--test/completion/ldapvi.exp1
-rw-r--r--test/completion/ldapwhoami.exp1
-rw-r--r--test/completion/lpq.exp1
-rw-r--r--test/completion/lpr.exp1
-rw-r--r--test/completion/makepkg.exp1
-rw-r--r--test/completion/mdadm.exp1
-rw-r--r--test/completion/mdtool.exp1
-rw-r--r--test/completion/medusa.exp1
-rw-r--r--test/completion/mii-diag.exp1
-rw-r--r--test/completion/mii-tool.exp1
-rw-r--r--test/completion/monodevelop.exp1
-rw-r--r--test/completion/msynctool.exp1
-rw-r--r--test/completion/mysql.exp1
-rw-r--r--test/completion/newusers.exp1
-rw-r--r--test/completion/nslookup.exp1
-rw-r--r--test/completion/passwd.exp1
-rw-r--r--test/completion/phing.exp1
-rw-r--r--test/completion/pinfo.exp1
-rw-r--r--test/completion/pkgtool.exp1
-rw-r--r--test/completion/postcat.exp1
-rw-r--r--test/completion/postconf.exp1
-rw-r--r--test/completion/postfix.exp1
-rw-r--r--test/completion/postmap.exp1
-rw-r--r--test/completion/postsuper.exp1
-rw-r--r--test/completion/prelink.exp1
-rw-r--r--test/completion/protoc.exp1
-rw-r--r--test/completion/puppet.exp1
-rw-r--r--test/completion/pwck.exp1
-rw-r--r--test/completion/pwdx.exp1
-rw-r--r--test/completion/pwgen.exp1
-rw-r--r--test/completion/qemu.exp1
-rw-r--r--test/completion/quota.exp1
-rw-r--r--test/completion/quotacheck.exp1
-rw-r--r--test/completion/quotaon.exp1
-rw-r--r--test/completion/rdesktop.exp1
-rw-r--r--test/completion/reptyr.exp1
-rw-r--r--test/completion/rfcomm.exp1
-rw-r--r--test/completion/route.exp1
-rw-r--r--test/completion/rpm2tgz.exp1
-rw-r--r--test/completion/rpmbuild.exp1
-rw-r--r--test/completion/sbopkg.exp1
-rw-r--r--test/completion/sdptool.exp1
-rw-r--r--test/completion/setquota.exp1
-rw-r--r--test/completion/slackpkg.exp1
-rw-r--r--test/completion/slapt-get.exp1
-rw-r--r--test/completion/slapt-src.exp1
-rw-r--r--test/completion/smbcacls.exp1
-rw-r--r--test/completion/smbclient.exp1
-rw-r--r--test/completion/smbcquotas.exp1
-rw-r--r--test/completion/smbget.exp1
-rw-r--r--test/completion/smbpasswd.exp1
-rw-r--r--test/completion/smbtar.exp1
-rw-r--r--test/completion/smbtree.exp1
-rw-r--r--test/completion/ssh-copy-id.exp1
-rw-r--r--test/completion/stream.exp1
-rw-r--r--test/completion/tcpdump.exp1
-rw-r--r--test/completion/tracepath.exp1
-rw-r--r--test/completion/upgradepkg.exp1
-rw-r--r--test/completion/vipw.exp1
-rw-r--r--test/completion/watch.exp1
-rw-r--r--test/completion/xgamma.exp1
-rw-r--r--test/completion/xzdec.exp1
-rw-r--r--test/fixtures/ant/build.xml17
-rw-r--r--test/fixtures/cvs/foo/CVS/Entries2
-rw-r--r--test/fixtures/cvs/foo/bar0
-rw-r--r--test/fixtures/cvs/foo/quux0
-rw-r--r--test/fixtures/htpasswd/htpasswd2
-rw-r--r--test/fixtures/mutt/bar/muttrc_b1
-rw-r--r--test/fixtures/mutt/foo/muttrc_f0
-rw-r--r--test/fixtures/mutt/muttrc1
-rw-r--r--test/fixtures/slackware/etc/slapt-get/slapt-getrc0
-rw-r--r--test/fixtures/slackware/etc/slapt-get/slapt-srcrc0
-rw-r--r--test/fixtures/slackware/home/abc-4-i686-1.txz1
-rw-r--r--test/fixtures/slackware/home/opq-1.0-2.i386.rpm1
-rw-r--r--test/fixtures/slackware/home/tcl.d/tcl.tgz1
-rw-r--r--test/fixtures/slackware/usr/src/slapt-src/slackbuilds_data20
-rw-r--r--test/fixtures/slackware/var/log/packages/radeontool-1.6.1-i486-124
-rw-r--r--test/fixtures/slackware/var/log/packages/rzip-2.1-i486-129
-rw-r--r--test/fixtures/slackware/var/slapt-get/package_data47
-rw-r--r--test/lib/completions/a2x.exp20
-rw-r--r--test/lib/completions/ant.exp6
-rw-r--r--test/lib/completions/arping.exp21
-rw-r--r--test/lib/completions/asciidoc.exp20
-rw-r--r--test/lib/completions/avctrl.exp20
-rw-r--r--test/lib/completions/base64.exp20
-rw-r--r--test/lib/completions/c++.exp1
-rw-r--r--test/lib/completions/cal.exp20
-rw-r--r--test/lib/completions/cfagent.exp20
-rw-r--r--test/lib/completions/chage.exp20
-rw-r--r--test/lib/completions/chown.exp6
-rw-r--r--test/lib/completions/chpasswd.exp20
-rw-r--r--test/lib/completions/chrpath.exp21
-rw-r--r--test/lib/completions/chsh.exp2
-rw-r--r--test/lib/completions/ciptool.exp20
-rw-r--r--test/lib/completions/compare.exp20
-rw-r--r--test/lib/completions/conjure.exp20
-rw-r--r--test/lib/completions/convert.exp2
-rw-r--r--test/lib/completions/cppcheck.exp30
-rw-r--r--test/lib/completions/curl.exp20
-rw-r--r--test/lib/completions/cvs.exp5
-rw-r--r--test/lib/completions/dfutool.exp20
-rw-r--r--test/lib/completions/display.exp17
-rw-r--r--test/lib/completions/dmesg.exp18
-rw-r--r--test/lib/completions/dot.exp20
-rw-r--r--test/lib/completions/explodepkg.exp25
-rw-r--r--test/lib/completions/faillog.exp20
-rw-r--r--test/lib/completions/fbgs.exp20
-rw-r--r--test/lib/completions/fbi.exp20
-rw-r--r--test/lib/completions/feh.exp55
-rw-r--r--test/lib/completions/file.exp21
-rw-r--r--test/lib/completions/find.exp2
-rw-r--r--test/lib/completions/finger.exp4
-rw-r--r--test/lib/completions/fusermount.exp20
-rw-r--r--test/lib/completions/gendiff.exp20
-rw-r--r--test/lib/completions/gnome-mplayer.exp20
-rw-r--r--test/lib/completions/gpasswd.exp20
-rw-r--r--test/lib/completions/grpck.exp20
-rw-r--r--test/lib/completions/hciattach.exp20
-rw-r--r--test/lib/completions/hciconfig.exp20
-rw-r--r--test/lib/completions/hddtemp.exp20
-rw-r--r--test/lib/completions/host.exp20
-rw-r--r--test/lib/completions/htpasswd.exp32
-rw-r--r--test/lib/completions/idn.exp20
-rw-r--r--test/lib/completions/import.exp20
-rw-r--r--test/lib/completions/installpkg.exp49
-rw-r--r--test/lib/completions/ionice.exp18
-rw-r--r--test/lib/completions/java.exp11
-rw-r--r--test/lib/completions/javadoc.exp6
-rw-r--r--test/lib/completions/jps.exp20
-rw-r--r--test/lib/completions/kcov.exp27
-rw-r--r--test/lib/completions/kill.exp8
-rw-r--r--test/lib/completions/killall.exp2
-rw-r--r--test/lib/completions/l2ping.exp20
-rw-r--r--test/lib/completions/lastlog.exp20
-rw-r--r--test/lib/completions/ldapadd.exp20
-rw-r--r--test/lib/completions/ldapcompare.exp20
-rw-r--r--test/lib/completions/ldapdelete.exp20
-rw-r--r--test/lib/completions/ldapmodrdn.exp20
-rw-r--r--test/lib/completions/ldappasswd.exp20
-rw-r--r--test/lib/completions/ldapsearch.exp20
-rw-r--r--test/lib/completions/ldapvi.exp20
-rw-r--r--test/lib/completions/ldapwhoami.exp20
-rw-r--r--test/lib/completions/lpq.exp20
-rw-r--r--test/lib/completions/lpr.exp20
-rw-r--r--test/lib/completions/lvchange.exp4
-rw-r--r--test/lib/completions/lvcreate.exp4
-rw-r--r--test/lib/completions/lvdisplay.exp4
-rw-r--r--test/lib/completions/lvextend.exp4
-rw-r--r--test/lib/completions/lvmdiskscan.exp4
-rw-r--r--test/lib/completions/lvreduce.exp4
-rw-r--r--test/lib/completions/lvremove.exp4
-rw-r--r--test/lib/completions/lvrename.exp4
-rw-r--r--test/lib/completions/lvresize.exp4
-rw-r--r--test/lib/completions/lvs.exp4
-rw-r--r--test/lib/completions/lvscan.exp4
-rw-r--r--test/lib/completions/makepkg.exp28
-rw-r--r--test/lib/completions/mdadm.exp18
-rw-r--r--test/lib/completions/mdtool.exp20
-rw-r--r--test/lib/completions/medusa.exp20
-rw-r--r--test/lib/completions/mii-diag.exp20
-rw-r--r--test/lib/completions/mii-tool.exp20
-rw-r--r--test/lib/completions/mkdir.exp7
-rw-r--r--test/lib/completions/monodevelop.exp20
-rw-r--r--test/lib/completions/mount.exp9
-rw-r--r--test/lib/completions/msynctool.exp20
-rw-r--r--test/lib/completions/mutt.exp16
-rw-r--r--test/lib/completions/mysql.exp20
-rw-r--r--test/lib/completions/newusers.exp20
-rw-r--r--test/lib/completions/nslookup.exp20
-rw-r--r--test/lib/completions/openssl.exp4
-rw-r--r--test/lib/completions/passwd.exp20
-rw-r--r--test/lib/completions/perl.exp2
-rw-r--r--test/lib/completions/perldoc.exp2
-rw-r--r--test/lib/completions/phing.exp20
-rw-r--r--test/lib/completions/pinfo.exp20
-rw-r--r--test/lib/completions/ping.exp3
-rw-r--r--test/lib/completions/pkgtool.exp20
-rw-r--r--test/lib/completions/postcat.exp20
-rw-r--r--test/lib/completions/postconf.exp20
-rw-r--r--test/lib/completions/postfix.exp20
-rw-r--r--test/lib/completions/postmap.exp20
-rw-r--r--test/lib/completions/postsuper.exp20
-rw-r--r--test/lib/completions/prelink.exp21
-rw-r--r--test/lib/completions/protoc.exp20
-rw-r--r--test/lib/completions/puppet.exp20
-rw-r--r--test/lib/completions/pvchange.exp4
-rw-r--r--test/lib/completions/pvcreate.exp4
-rw-r--r--test/lib/completions/pvdisplay.exp4
-rw-r--r--test/lib/completions/pvremove.exp4
-rw-r--r--test/lib/completions/pvs.exp4
-rw-r--r--test/lib/completions/pwck.exp20
-rw-r--r--test/lib/completions/pwdx.exp20
-rw-r--r--test/lib/completions/pwgen.exp20
-rw-r--r--test/lib/completions/qemu.exp20
-rw-r--r--test/lib/completions/quota.exp20
-rw-r--r--test/lib/completions/quotacheck.exp20
-rw-r--r--test/lib/completions/quotaon.exp20
-rw-r--r--test/lib/completions/rdesktop.exp20
-rw-r--r--test/lib/completions/removepkg.exp19
-rw-r--r--test/lib/completions/reptyr.exp22
-rw-r--r--test/lib/completions/rfcomm.exp20
-rw-r--r--test/lib/completions/ri.exp2
-rw-r--r--test/lib/completions/route.exp20
-rw-r--r--test/lib/completions/rpm2tgz.exp31
-rw-r--r--test/lib/completions/rpmbuild.exp20
-rw-r--r--test/lib/completions/rsync.exp6
-rw-r--r--test/lib/completions/sbopkg.exp20
-rw-r--r--test/lib/completions/scp.exp9
-rw-r--r--test/lib/completions/screen.exp8
-rw-r--r--test/lib/completions/sdptool.exp20
-rw-r--r--test/lib/completions/setquota.exp20
-rw-r--r--test/lib/completions/slackpkg.exp20
-rw-r--r--test/lib/completions/slapt-get.exp46
-rw-r--r--test/lib/completions/slapt-src.exp49
-rw-r--r--test/lib/completions/smbcacls.exp20
-rw-r--r--test/lib/completions/smbclient.exp20
-rw-r--r--test/lib/completions/smbcquotas.exp20
-rw-r--r--test/lib/completions/smbget.exp20
-rw-r--r--test/lib/completions/smbpasswd.exp20
-rw-r--r--test/lib/completions/smbtar.exp20
-rw-r--r--test/lib/completions/smbtree.exp20
-rw-r--r--test/lib/completions/ssh-copy-id.exp20
-rw-r--r--test/lib/completions/stream.exp20
-rw-r--r--test/lib/completions/sudo.exp59
-rw-r--r--test/lib/completions/tcpdump.exp20
-rw-r--r--test/lib/completions/time.exp18
-rw-r--r--test/lib/completions/tracepath.exp21
-rw-r--r--test/lib/completions/upgradepkg.exp39
-rw-r--r--test/lib/completions/vgcfgbackup.exp4
-rw-r--r--test/lib/completions/vgcfgrestore.exp4
-rw-r--r--test/lib/completions/vgck.exp4
-rw-r--r--test/lib/completions/vgconvert.exp4
-rw-r--r--test/lib/completions/vgdisplay.exp4
-rw-r--r--test/lib/completions/vgexport.exp4
-rw-r--r--test/lib/completions/vgextend.exp4
-rw-r--r--test/lib/completions/vgimport.exp4
-rw-r--r--test/lib/completions/vgmerge.exp4
-rw-r--r--test/lib/completions/vgmknodes.exp4
-rw-r--r--test/lib/completions/vgreduce.exp4
-rw-r--r--test/lib/completions/vgremove.exp4
-rw-r--r--test/lib/completions/vgrename.exp4
-rw-r--r--test/lib/completions/vgs.exp4
-rw-r--r--test/lib/completions/vgscan.exp4
-rw-r--r--test/lib/completions/vipw.exp20
-rw-r--r--test/lib/completions/watch.exp18
-rw-r--r--test/lib/completions/xgamma.exp21
-rw-r--r--test/lib/completions/xhost.exp6
-rw-r--r--test/lib/completions/xvnc4viewer.exp2
-rw-r--r--test/lib/completions/xzdec.exp20
-rw-r--r--test/lib/library.exp60
-rw-r--r--test/lib/library.sh10
-rw-r--r--test/unit/_filedir.exp107
-rw-r--r--test/unit/_get_comp_words_by_ref.exp176
-rw-r--r--test/unit/_get_cword.exp94
-rw-r--r--test/unit/_init_completion.exp35
-rw-r--r--test/unit/_known_hosts_real.exp8
-rw-r--r--test/unit/_parse_help.exp74
-rw-r--r--test/unit/_parse_usage.exp59
-rw-r--r--test/unit/compgen.exp24
308 files changed, 3283 insertions, 383 deletions
diff --git a/test/Makefile.in b/test/Makefile.in
index aa81fbeb..d71b99ae 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -64,6 +64,7 @@ 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@
@@ -86,16 +87,15 @@ abs_top_srcdir = @abs_top_srcdir@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
-bashcompdir = @bashcompdir@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
+compatdir = @compatdir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
-helpersdir = @helpersdir@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
diff --git a/test/completion/a2x.exp b/test/completion/a2x.exp
new file mode 100644
index 00000000..5d4098f1
--- /dev/null
+++ b/test/completion/a2x.exp
@@ -0,0 +1 @@
+assert_source_completions a2x
diff --git a/test/completion/arping.exp b/test/completion/arping.exp
new file mode 100644
index 00000000..5a64b1a3
--- /dev/null
+++ b/test/completion/arping.exp
@@ -0,0 +1 @@
+assert_source_completions arping
diff --git a/test/completion/asciidoc.exp b/test/completion/asciidoc.exp
new file mode 100644
index 00000000..05b3f1f2
--- /dev/null
+++ b/test/completion/asciidoc.exp
@@ -0,0 +1 @@
+assert_source_completions asciidoc
diff --git a/test/completion/avctrl.exp b/test/completion/avctrl.exp
new file mode 100644
index 00000000..ea323c51
--- /dev/null
+++ b/test/completion/avctrl.exp
@@ -0,0 +1 @@
+assert_source_completions avctrl
diff --git a/test/completion/base64.exp b/test/completion/base64.exp
new file mode 100644
index 00000000..2f5f6122
--- /dev/null
+++ b/test/completion/base64.exp
@@ -0,0 +1 @@
+assert_source_completions base64
diff --git a/test/completion/cal.exp b/test/completion/cal.exp
new file mode 100644
index 00000000..5fba48be
--- /dev/null
+++ b/test/completion/cal.exp
@@ -0,0 +1 @@
+assert_source_completions cal
diff --git a/test/completion/cfagent.exp b/test/completion/cfagent.exp
new file mode 100644
index 00000000..21d71e20
--- /dev/null
+++ b/test/completion/cfagent.exp
@@ -0,0 +1 @@
+assert_source_completions cfagent
diff --git a/test/completion/chage.exp b/test/completion/chage.exp
new file mode 100644
index 00000000..32dc4409
--- /dev/null
+++ b/test/completion/chage.exp
@@ -0,0 +1 @@
+assert_source_completions chage
diff --git a/test/completion/chpasswd.exp b/test/completion/chpasswd.exp
new file mode 100644
index 00000000..854266c1
--- /dev/null
+++ b/test/completion/chpasswd.exp
@@ -0,0 +1 @@
+assert_source_completions chpasswd
diff --git a/test/completion/chrpath.exp b/test/completion/chrpath.exp
new file mode 100644
index 00000000..eee81ec7
--- /dev/null
+++ b/test/completion/chrpath.exp
@@ -0,0 +1 @@
+assert_source_completions chrpath
diff --git a/test/completion/ciptool.exp b/test/completion/ciptool.exp
new file mode 100644
index 00000000..206f21c6
--- /dev/null
+++ b/test/completion/ciptool.exp
@@ -0,0 +1 @@
+assert_source_completions ciptool
diff --git a/test/completion/compare.exp b/test/completion/compare.exp
new file mode 100644
index 00000000..d2ea0cc7
--- /dev/null
+++ b/test/completion/compare.exp
@@ -0,0 +1 @@
+assert_source_completions compare
diff --git a/test/completion/conjure.exp b/test/completion/conjure.exp
new file mode 100644
index 00000000..687c6107
--- /dev/null
+++ b/test/completion/conjure.exp
@@ -0,0 +1 @@
+assert_source_completions conjure
diff --git a/test/completion/cppcheck.exp b/test/completion/cppcheck.exp
new file mode 100644
index 00000000..1cfb9c56
--- /dev/null
+++ b/test/completion/cppcheck.exp
@@ -0,0 +1 @@
+assert_source_completions cppcheck
diff --git a/test/completion/curl.exp b/test/completion/curl.exp
new file mode 100644
index 00000000..e8bf2135
--- /dev/null
+++ b/test/completion/curl.exp
@@ -0,0 +1 @@
+assert_source_completions curl
diff --git a/test/completion/dfutool.exp b/test/completion/dfutool.exp
new file mode 100644
index 00000000..0859f07e
--- /dev/null
+++ b/test/completion/dfutool.exp
@@ -0,0 +1 @@
+assert_source_completions dfutool
diff --git a/test/completion/dmesg.exp b/test/completion/dmesg.exp
new file mode 100644
index 00000000..1eca1e5b
--- /dev/null
+++ b/test/completion/dmesg.exp
@@ -0,0 +1 @@
+assert_source_completions dmesg
diff --git a/test/completion/dot.exp b/test/completion/dot.exp
new file mode 100644
index 00000000..d12422c1
--- /dev/null
+++ b/test/completion/dot.exp
@@ -0,0 +1 @@
+assert_source_completions dot
diff --git a/test/completion/explodepkg.exp b/test/completion/explodepkg.exp
new file mode 100644
index 00000000..7d6ce793
--- /dev/null
+++ b/test/completion/explodepkg.exp
@@ -0,0 +1 @@
+assert_source_completions explodepkg
diff --git a/test/completion/faillog.exp b/test/completion/faillog.exp
new file mode 100644
index 00000000..46d19d9a
--- /dev/null
+++ b/test/completion/faillog.exp
@@ -0,0 +1 @@
+assert_source_completions faillog
diff --git a/test/completion/fbgs.exp b/test/completion/fbgs.exp
new file mode 100644
index 00000000..38efcbe9
--- /dev/null
+++ b/test/completion/fbgs.exp
@@ -0,0 +1 @@
+assert_source_completions fbgs
diff --git a/test/completion/fbi.exp b/test/completion/fbi.exp
new file mode 100644
index 00000000..36f8b8ea
--- /dev/null
+++ b/test/completion/fbi.exp
@@ -0,0 +1 @@
+assert_source_completions fbi
diff --git a/test/completion/feh.exp b/test/completion/feh.exp
new file mode 100644
index 00000000..4613bfaf
--- /dev/null
+++ b/test/completion/feh.exp
@@ -0,0 +1 @@
+assert_source_completions feh
diff --git a/test/completion/file.exp b/test/completion/file.exp
new file mode 100644
index 00000000..92662f0a
--- /dev/null
+++ b/test/completion/file.exp
@@ -0,0 +1 @@
+assert_source_completions file
diff --git a/test/completion/fusermount.exp b/test/completion/fusermount.exp
new file mode 100644
index 00000000..7b9e0391
--- /dev/null
+++ b/test/completion/fusermount.exp
@@ -0,0 +1 @@
+assert_source_completions fusermount
diff --git a/test/completion/gendiff.exp b/test/completion/gendiff.exp
new file mode 100644
index 00000000..f3a3fe19
--- /dev/null
+++ b/test/completion/gendiff.exp
@@ -0,0 +1 @@
+assert_source_completions gendiff
diff --git a/test/completion/gnome-mplayer.exp b/test/completion/gnome-mplayer.exp
new file mode 100644
index 00000000..79c0cb1e
--- /dev/null
+++ b/test/completion/gnome-mplayer.exp
@@ -0,0 +1 @@
+assert_source_completions gnome-mplayer
diff --git a/test/completion/gpasswd.exp b/test/completion/gpasswd.exp
new file mode 100644
index 00000000..cf07a4de
--- /dev/null
+++ b/test/completion/gpasswd.exp
@@ -0,0 +1 @@
+assert_source_completions gpasswd
diff --git a/test/completion/grpck.exp b/test/completion/grpck.exp
new file mode 100644
index 00000000..db2caeea
--- /dev/null
+++ b/test/completion/grpck.exp
@@ -0,0 +1 @@
+assert_source_completions grpck
diff --git a/test/completion/hciattach.exp b/test/completion/hciattach.exp
new file mode 100644
index 00000000..f85a3558
--- /dev/null
+++ b/test/completion/hciattach.exp
@@ -0,0 +1 @@
+assert_source_completions hciattach
diff --git a/test/completion/hciconfig.exp b/test/completion/hciconfig.exp
new file mode 100644
index 00000000..5f109956
--- /dev/null
+++ b/test/completion/hciconfig.exp
@@ -0,0 +1 @@
+assert_source_completions hciconfig
diff --git a/test/completion/hddtemp.exp b/test/completion/hddtemp.exp
new file mode 100644
index 00000000..f8c63d62
--- /dev/null
+++ b/test/completion/hddtemp.exp
@@ -0,0 +1 @@
+assert_source_completions hddtemp
diff --git a/test/completion/host.exp b/test/completion/host.exp
new file mode 100644
index 00000000..9866e1e1
--- /dev/null
+++ b/test/completion/host.exp
@@ -0,0 +1 @@
+assert_source_completions host
diff --git a/test/completion/htpasswd.exp b/test/completion/htpasswd.exp
new file mode 100644
index 00000000..08294f35
--- /dev/null
+++ b/test/completion/htpasswd.exp
@@ -0,0 +1 @@
+assert_source_completions htpasswd
diff --git a/test/completion/idn.exp b/test/completion/idn.exp
new file mode 100644
index 00000000..5fccae3d
--- /dev/null
+++ b/test/completion/idn.exp
@@ -0,0 +1 @@
+assert_source_completions idn
diff --git a/test/completion/import.exp b/test/completion/import.exp
new file mode 100644
index 00000000..682a5069
--- /dev/null
+++ b/test/completion/import.exp
@@ -0,0 +1 @@
+assert_source_completions import
diff --git a/test/completion/installpkg.exp b/test/completion/installpkg.exp
new file mode 100644
index 00000000..47f85f41
--- /dev/null
+++ b/test/completion/installpkg.exp
@@ -0,0 +1 @@
+assert_source_completions installpkg
diff --git a/test/completion/ionice.exp b/test/completion/ionice.exp
new file mode 100644
index 00000000..d569f418
--- /dev/null
+++ b/test/completion/ionice.exp
@@ -0,0 +1 @@
+assert_source_completions ionice
diff --git a/test/completion/jps.exp b/test/completion/jps.exp
new file mode 100644
index 00000000..8a04f645
--- /dev/null
+++ b/test/completion/jps.exp
@@ -0,0 +1 @@
+assert_source_completions jps
diff --git a/test/completion/kcov.exp b/test/completion/kcov.exp
new file mode 100644
index 00000000..4f0b9a7c
--- /dev/null
+++ b/test/completion/kcov.exp
@@ -0,0 +1 @@
+assert_source_completions kcov
diff --git a/test/completion/l2ping.exp b/test/completion/l2ping.exp
new file mode 100644
index 00000000..5bd300d3
--- /dev/null
+++ b/test/completion/l2ping.exp
@@ -0,0 +1 @@
+assert_source_completions l2ping
diff --git a/test/completion/lastlog.exp b/test/completion/lastlog.exp
new file mode 100644
index 00000000..cefb67b9
--- /dev/null
+++ b/test/completion/lastlog.exp
@@ -0,0 +1 @@
+assert_source_completions lastlog
diff --git a/test/completion/ldapadd.exp b/test/completion/ldapadd.exp
new file mode 100644
index 00000000..2c74de74
--- /dev/null
+++ b/test/completion/ldapadd.exp
@@ -0,0 +1 @@
+assert_source_completions ldapadd
diff --git a/test/completion/ldapcompare.exp b/test/completion/ldapcompare.exp
new file mode 100644
index 00000000..bb1db4c3
--- /dev/null
+++ b/test/completion/ldapcompare.exp
@@ -0,0 +1 @@
+assert_source_completions ldapcompare
diff --git a/test/completion/ldapdelete.exp b/test/completion/ldapdelete.exp
new file mode 100644
index 00000000..76027d9f
--- /dev/null
+++ b/test/completion/ldapdelete.exp
@@ -0,0 +1 @@
+assert_source_completions ldapdelete
diff --git a/test/completion/ldapmodrdn.exp b/test/completion/ldapmodrdn.exp
new file mode 100644
index 00000000..9614af6c
--- /dev/null
+++ b/test/completion/ldapmodrdn.exp
@@ -0,0 +1 @@
+assert_source_completions ldapmodrdn
diff --git a/test/completion/ldappasswd.exp b/test/completion/ldappasswd.exp
new file mode 100644
index 00000000..0a5ac72c
--- /dev/null
+++ b/test/completion/ldappasswd.exp
@@ -0,0 +1 @@
+assert_source_completions ldappasswd
diff --git a/test/completion/ldapsearch.exp b/test/completion/ldapsearch.exp
new file mode 100644
index 00000000..c552967d
--- /dev/null
+++ b/test/completion/ldapsearch.exp
@@ -0,0 +1 @@
+assert_source_completions ldapsearch
diff --git a/test/completion/ldapvi.exp b/test/completion/ldapvi.exp
new file mode 100644
index 00000000..2e3ddef2
--- /dev/null
+++ b/test/completion/ldapvi.exp
@@ -0,0 +1 @@
+assert_source_completions ldapvi
diff --git a/test/completion/ldapwhoami.exp b/test/completion/ldapwhoami.exp
new file mode 100644
index 00000000..9d07d8a8
--- /dev/null
+++ b/test/completion/ldapwhoami.exp
@@ -0,0 +1 @@
+assert_source_completions ldapwhoami
diff --git a/test/completion/lpq.exp b/test/completion/lpq.exp
new file mode 100644
index 00000000..062d0c09
--- /dev/null
+++ b/test/completion/lpq.exp
@@ -0,0 +1 @@
+assert_source_completions lpq
diff --git a/test/completion/lpr.exp b/test/completion/lpr.exp
new file mode 100644
index 00000000..6f65fee3
--- /dev/null
+++ b/test/completion/lpr.exp
@@ -0,0 +1 @@
+assert_source_completions lpr
diff --git a/test/completion/makepkg.exp b/test/completion/makepkg.exp
new file mode 100644
index 00000000..a4f5e38c
--- /dev/null
+++ b/test/completion/makepkg.exp
@@ -0,0 +1 @@
+assert_source_completions makepkg
diff --git a/test/completion/mdadm.exp b/test/completion/mdadm.exp
new file mode 100644
index 00000000..ad3c36f4
--- /dev/null
+++ b/test/completion/mdadm.exp
@@ -0,0 +1 @@
+assert_source_completions mdadm
diff --git a/test/completion/mdtool.exp b/test/completion/mdtool.exp
new file mode 100644
index 00000000..f7604e13
--- /dev/null
+++ b/test/completion/mdtool.exp
@@ -0,0 +1 @@
+assert_source_completions mdtool
diff --git a/test/completion/medusa.exp b/test/completion/medusa.exp
new file mode 100644
index 00000000..237cdd54
--- /dev/null
+++ b/test/completion/medusa.exp
@@ -0,0 +1 @@
+assert_source_completions medusa
diff --git a/test/completion/mii-diag.exp b/test/completion/mii-diag.exp
new file mode 100644
index 00000000..b4ddef79
--- /dev/null
+++ b/test/completion/mii-diag.exp
@@ -0,0 +1 @@
+assert_source_completions mii-diag
diff --git a/test/completion/mii-tool.exp b/test/completion/mii-tool.exp
new file mode 100644
index 00000000..cd12f228
--- /dev/null
+++ b/test/completion/mii-tool.exp
@@ -0,0 +1 @@
+assert_source_completions mii-tool
diff --git a/test/completion/monodevelop.exp b/test/completion/monodevelop.exp
new file mode 100644
index 00000000..1c4fd45b
--- /dev/null
+++ b/test/completion/monodevelop.exp
@@ -0,0 +1 @@
+assert_source_completions monodevelop
diff --git a/test/completion/msynctool.exp b/test/completion/msynctool.exp
new file mode 100644
index 00000000..76be37ef
--- /dev/null
+++ b/test/completion/msynctool.exp
@@ -0,0 +1 @@
+assert_source_completions msynctool
diff --git a/test/completion/mysql.exp b/test/completion/mysql.exp
new file mode 100644
index 00000000..ad9fac69
--- /dev/null
+++ b/test/completion/mysql.exp
@@ -0,0 +1 @@
+assert_source_completions mysql
diff --git a/test/completion/newusers.exp b/test/completion/newusers.exp
new file mode 100644
index 00000000..c9ea45c6
--- /dev/null
+++ b/test/completion/newusers.exp
@@ -0,0 +1 @@
+assert_source_completions newusers
diff --git a/test/completion/nslookup.exp b/test/completion/nslookup.exp
new file mode 100644
index 00000000..5a26b495
--- /dev/null
+++ b/test/completion/nslookup.exp
@@ -0,0 +1 @@
+assert_source_completions nslookup
diff --git a/test/completion/passwd.exp b/test/completion/passwd.exp
new file mode 100644
index 00000000..2f0bec9b
--- /dev/null
+++ b/test/completion/passwd.exp
@@ -0,0 +1 @@
+assert_source_completions passwd
diff --git a/test/completion/phing.exp b/test/completion/phing.exp
new file mode 100644
index 00000000..957999bc
--- /dev/null
+++ b/test/completion/phing.exp
@@ -0,0 +1 @@
+assert_source_completions phing
diff --git a/test/completion/pinfo.exp b/test/completion/pinfo.exp
new file mode 100644
index 00000000..3e937568
--- /dev/null
+++ b/test/completion/pinfo.exp
@@ -0,0 +1 @@
+assert_source_completions pinfo
diff --git a/test/completion/pkgtool.exp b/test/completion/pkgtool.exp
new file mode 100644
index 00000000..4a946c52
--- /dev/null
+++ b/test/completion/pkgtool.exp
@@ -0,0 +1 @@
+assert_source_completions pkgtool
diff --git a/test/completion/postcat.exp b/test/completion/postcat.exp
new file mode 100644
index 00000000..eb4ae6da
--- /dev/null
+++ b/test/completion/postcat.exp
@@ -0,0 +1 @@
+assert_source_completions postcat
diff --git a/test/completion/postconf.exp b/test/completion/postconf.exp
new file mode 100644
index 00000000..7ed485c2
--- /dev/null
+++ b/test/completion/postconf.exp
@@ -0,0 +1 @@
+assert_source_completions postconf
diff --git a/test/completion/postfix.exp b/test/completion/postfix.exp
new file mode 100644
index 00000000..4a39d044
--- /dev/null
+++ b/test/completion/postfix.exp
@@ -0,0 +1 @@
+assert_source_completions postfix
diff --git a/test/completion/postmap.exp b/test/completion/postmap.exp
new file mode 100644
index 00000000..870af8d1
--- /dev/null
+++ b/test/completion/postmap.exp
@@ -0,0 +1 @@
+assert_source_completions postmap
diff --git a/test/completion/postsuper.exp b/test/completion/postsuper.exp
new file mode 100644
index 00000000..fac52381
--- /dev/null
+++ b/test/completion/postsuper.exp
@@ -0,0 +1 @@
+assert_source_completions postsuper
diff --git a/test/completion/prelink.exp b/test/completion/prelink.exp
new file mode 100644
index 00000000..d1fbb8ee
--- /dev/null
+++ b/test/completion/prelink.exp
@@ -0,0 +1 @@
+assert_source_completions prelink
diff --git a/test/completion/protoc.exp b/test/completion/protoc.exp
new file mode 100644
index 00000000..333ebf26
--- /dev/null
+++ b/test/completion/protoc.exp
@@ -0,0 +1 @@
+assert_source_completions protoc
diff --git a/test/completion/puppet.exp b/test/completion/puppet.exp
new file mode 100644
index 00000000..28463445
--- /dev/null
+++ b/test/completion/puppet.exp
@@ -0,0 +1 @@
+assert_source_completions puppet
diff --git a/test/completion/pwck.exp b/test/completion/pwck.exp
new file mode 100644
index 00000000..55d5f95c
--- /dev/null
+++ b/test/completion/pwck.exp
@@ -0,0 +1 @@
+assert_source_completions pwck
diff --git a/test/completion/pwdx.exp b/test/completion/pwdx.exp
new file mode 100644
index 00000000..dd97822a
--- /dev/null
+++ b/test/completion/pwdx.exp
@@ -0,0 +1 @@
+assert_source_completions pwdx
diff --git a/test/completion/pwgen.exp b/test/completion/pwgen.exp
new file mode 100644
index 00000000..bba75ecd
--- /dev/null
+++ b/test/completion/pwgen.exp
@@ -0,0 +1 @@
+assert_source_completions pwgen
diff --git a/test/completion/qemu.exp b/test/completion/qemu.exp
new file mode 100644
index 00000000..deedd3a2
--- /dev/null
+++ b/test/completion/qemu.exp
@@ -0,0 +1 @@
+assert_source_completions qemu
diff --git a/test/completion/quota.exp b/test/completion/quota.exp
new file mode 100644
index 00000000..9c08b4f3
--- /dev/null
+++ b/test/completion/quota.exp
@@ -0,0 +1 @@
+assert_source_completions quota
diff --git a/test/completion/quotacheck.exp b/test/completion/quotacheck.exp
new file mode 100644
index 00000000..5b53da8f
--- /dev/null
+++ b/test/completion/quotacheck.exp
@@ -0,0 +1 @@
+assert_source_completions quotacheck
diff --git a/test/completion/quotaon.exp b/test/completion/quotaon.exp
new file mode 100644
index 00000000..e66056fc
--- /dev/null
+++ b/test/completion/quotaon.exp
@@ -0,0 +1 @@
+assert_source_completions quotaon
diff --git a/test/completion/rdesktop.exp b/test/completion/rdesktop.exp
new file mode 100644
index 00000000..29eddf6e
--- /dev/null
+++ b/test/completion/rdesktop.exp
@@ -0,0 +1 @@
+assert_source_completions rdesktop
diff --git a/test/completion/reptyr.exp b/test/completion/reptyr.exp
new file mode 100644
index 00000000..62ab427d
--- /dev/null
+++ b/test/completion/reptyr.exp
@@ -0,0 +1 @@
+assert_source_completions reptyr
diff --git a/test/completion/rfcomm.exp b/test/completion/rfcomm.exp
new file mode 100644
index 00000000..6de31dc2
--- /dev/null
+++ b/test/completion/rfcomm.exp
@@ -0,0 +1 @@
+assert_source_completions rfcomm
diff --git a/test/completion/route.exp b/test/completion/route.exp
new file mode 100644
index 00000000..beff8251
--- /dev/null
+++ b/test/completion/route.exp
@@ -0,0 +1 @@
+assert_source_completions route
diff --git a/test/completion/rpm2tgz.exp b/test/completion/rpm2tgz.exp
new file mode 100644
index 00000000..6acd954a
--- /dev/null
+++ b/test/completion/rpm2tgz.exp
@@ -0,0 +1 @@
+assert_source_completions rpm2tgz
diff --git a/test/completion/rpmbuild.exp b/test/completion/rpmbuild.exp
new file mode 100644
index 00000000..f829b588
--- /dev/null
+++ b/test/completion/rpmbuild.exp
@@ -0,0 +1 @@
+assert_source_completions rpmbuild
diff --git a/test/completion/sbopkg.exp b/test/completion/sbopkg.exp
new file mode 100644
index 00000000..0fec4db1
--- /dev/null
+++ b/test/completion/sbopkg.exp
@@ -0,0 +1 @@
+assert_source_completions sbopkg
diff --git a/test/completion/sdptool.exp b/test/completion/sdptool.exp
new file mode 100644
index 00000000..6d20cf99
--- /dev/null
+++ b/test/completion/sdptool.exp
@@ -0,0 +1 @@
+assert_source_completions sdptool
diff --git a/test/completion/setquota.exp b/test/completion/setquota.exp
new file mode 100644
index 00000000..c97dccc0
--- /dev/null
+++ b/test/completion/setquota.exp
@@ -0,0 +1 @@
+assert_source_completions setquota
diff --git a/test/completion/slackpkg.exp b/test/completion/slackpkg.exp
new file mode 100644
index 00000000..ecef64d0
--- /dev/null
+++ b/test/completion/slackpkg.exp
@@ -0,0 +1 @@
+assert_source_completions slackpkg
diff --git a/test/completion/slapt-get.exp b/test/completion/slapt-get.exp
new file mode 100644
index 00000000..6c37d523
--- /dev/null
+++ b/test/completion/slapt-get.exp
@@ -0,0 +1 @@
+assert_source_completions slapt-get
diff --git a/test/completion/slapt-src.exp b/test/completion/slapt-src.exp
new file mode 100644
index 00000000..90abfd5f
--- /dev/null
+++ b/test/completion/slapt-src.exp
@@ -0,0 +1 @@
+assert_source_completions slapt-src
diff --git a/test/completion/smbcacls.exp b/test/completion/smbcacls.exp
new file mode 100644
index 00000000..333a14e7
--- /dev/null
+++ b/test/completion/smbcacls.exp
@@ -0,0 +1 @@
+assert_source_completions smbcacls
diff --git a/test/completion/smbclient.exp b/test/completion/smbclient.exp
new file mode 100644
index 00000000..09b9ad33
--- /dev/null
+++ b/test/completion/smbclient.exp
@@ -0,0 +1 @@
+assert_source_completions smbclient
diff --git a/test/completion/smbcquotas.exp b/test/completion/smbcquotas.exp
new file mode 100644
index 00000000..f7c4e94a
--- /dev/null
+++ b/test/completion/smbcquotas.exp
@@ -0,0 +1 @@
+assert_source_completions smbcquotas
diff --git a/test/completion/smbget.exp b/test/completion/smbget.exp
new file mode 100644
index 00000000..8f6c849e
--- /dev/null
+++ b/test/completion/smbget.exp
@@ -0,0 +1 @@
+assert_source_completions smbget
diff --git a/test/completion/smbpasswd.exp b/test/completion/smbpasswd.exp
new file mode 100644
index 00000000..de2297a6
--- /dev/null
+++ b/test/completion/smbpasswd.exp
@@ -0,0 +1 @@
+assert_source_completions smbpasswd
diff --git a/test/completion/smbtar.exp b/test/completion/smbtar.exp
new file mode 100644
index 00000000..72dd9f1f
--- /dev/null
+++ b/test/completion/smbtar.exp
@@ -0,0 +1 @@
+assert_source_completions smbtar
diff --git a/test/completion/smbtree.exp b/test/completion/smbtree.exp
new file mode 100644
index 00000000..713c5bab
--- /dev/null
+++ b/test/completion/smbtree.exp
@@ -0,0 +1 @@
+assert_source_completions smbtree
diff --git a/test/completion/ssh-copy-id.exp b/test/completion/ssh-copy-id.exp
new file mode 100644
index 00000000..c4923e78
--- /dev/null
+++ b/test/completion/ssh-copy-id.exp
@@ -0,0 +1 @@
+assert_source_completions ssh-copy-id
diff --git a/test/completion/stream.exp b/test/completion/stream.exp
new file mode 100644
index 00000000..fba2104f
--- /dev/null
+++ b/test/completion/stream.exp
@@ -0,0 +1 @@
+assert_source_completions stream
diff --git a/test/completion/tcpdump.exp b/test/completion/tcpdump.exp
new file mode 100644
index 00000000..13eb744e
--- /dev/null
+++ b/test/completion/tcpdump.exp
@@ -0,0 +1 @@
+assert_source_completions tcpdump
diff --git a/test/completion/tracepath.exp b/test/completion/tracepath.exp
new file mode 100644
index 00000000..621f0ba8
--- /dev/null
+++ b/test/completion/tracepath.exp
@@ -0,0 +1 @@
+assert_source_completions tracepath
diff --git a/test/completion/upgradepkg.exp b/test/completion/upgradepkg.exp
new file mode 100644
index 00000000..4b181a86
--- /dev/null
+++ b/test/completion/upgradepkg.exp
@@ -0,0 +1 @@
+assert_source_completions upgradepkg
diff --git a/test/completion/vipw.exp b/test/completion/vipw.exp
new file mode 100644
index 00000000..38438679
--- /dev/null
+++ b/test/completion/vipw.exp
@@ -0,0 +1 @@
+assert_source_completions vipw
diff --git a/test/completion/watch.exp b/test/completion/watch.exp
new file mode 100644
index 00000000..9bb0644f
--- /dev/null
+++ b/test/completion/watch.exp
@@ -0,0 +1 @@
+assert_source_completions watch
diff --git a/test/completion/xgamma.exp b/test/completion/xgamma.exp
new file mode 100644
index 00000000..706e74f9
--- /dev/null
+++ b/test/completion/xgamma.exp
@@ -0,0 +1 @@
+assert_source_completions xgamma
diff --git a/test/completion/xzdec.exp b/test/completion/xzdec.exp
new file mode 100644
index 00000000..65330d6b
--- /dev/null
+++ b/test/completion/xzdec.exp
@@ -0,0 +1 @@
+assert_source_completions xzdec
diff --git a/test/fixtures/ant/build.xml b/test/fixtures/ant/build.xml
new file mode 100644
index 00000000..146c7f3b
--- /dev/null
+++ b/test/fixtures/ant/build.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="." default="build" name="bash-completion">
+ <target name="clean">
+ <!-- ... -->
+ </target>
+<target
+ name="realclean" depends="clean">
+ <!-- ... -->
+ </target>
+
+ <target foo="bar" name="init"></target>
+<target
+foo="bar"
+name='bashcomp' >
+<!-- ... -->
+</target>
+</project>
diff --git a/test/fixtures/cvs/foo/CVS/Entries b/test/fixtures/cvs/foo/CVS/Entries
new file mode 100644
index 00000000..6462f980
--- /dev/null
+++ b/test/fixtures/cvs/foo/CVS/Entries
@@ -0,0 +1,2 @@
+/bar/1.1/Tue Jan 29 05:52:29 2008//
+D
diff --git a/test/fixtures/cvs/foo/bar b/test/fixtures/cvs/foo/bar
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/cvs/foo/bar
diff --git a/test/fixtures/cvs/foo/quux b/test/fixtures/cvs/foo/quux
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/cvs/foo/quux
diff --git a/test/fixtures/htpasswd/htpasswd b/test/fixtures/htpasswd/htpasswd
new file mode 100644
index 00000000..5279c7c3
--- /dev/null
+++ b/test/fixtures/htpasswd/htpasswd
@@ -0,0 +1,2 @@
+foo:bar
+quux:baz
diff --git a/test/fixtures/mutt/bar/muttrc_b b/test/fixtures/mutt/bar/muttrc_b
new file mode 100644
index 00000000..f4a0493e
--- /dev/null
+++ b/test/fixtures/mutt/bar/muttrc_b
@@ -0,0 +1 @@
+source ~/foo/muttrc_f
diff --git a/test/fixtures/mutt/foo/muttrc_f b/test/fixtures/mutt/foo/muttrc_f
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/mutt/foo/muttrc_f
diff --git a/test/fixtures/mutt/muttrc b/test/fixtures/mutt/muttrc
index 58ad7f55..d26c8bc6 100644
--- a/test/fixtures/mutt/muttrc
+++ b/test/fixtures/mutt/muttrc
@@ -1,3 +1,4 @@
set folder=.
alias a1 a1@example.com
alias a2 a2@example.com
+source ~/bar/muttrc_b
diff --git a/test/fixtures/slackware/etc/slapt-get/slapt-getrc b/test/fixtures/slackware/etc/slapt-get/slapt-getrc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/slackware/etc/slapt-get/slapt-getrc
diff --git a/test/fixtures/slackware/etc/slapt-get/slapt-srcrc b/test/fixtures/slackware/etc/slapt-get/slapt-srcrc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/fixtures/slackware/etc/slapt-get/slapt-srcrc
diff --git a/test/fixtures/slackware/home/abc-4-i686-1.txz b/test/fixtures/slackware/home/abc-4-i686-1.txz
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/test/fixtures/slackware/home/abc-4-i686-1.txz
@@ -0,0 +1 @@
+
diff --git a/test/fixtures/slackware/home/opq-1.0-2.i386.rpm b/test/fixtures/slackware/home/opq-1.0-2.i386.rpm
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/test/fixtures/slackware/home/opq-1.0-2.i386.rpm
@@ -0,0 +1 @@
+
diff --git a/test/fixtures/slackware/home/tcl.d/tcl.tgz b/test/fixtures/slackware/home/tcl.d/tcl.tgz
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/test/fixtures/slackware/home/tcl.d/tcl.tgz
@@ -0,0 +1 @@
+
diff --git a/test/fixtures/slackware/usr/src/slapt-src/slackbuilds_data b/test/fixtures/slackware/usr/src/slapt-src/slackbuilds_data
new file mode 100644
index 00000000..0f4ee44b
--- /dev/null
+++ b/test/fixtures/slackware/usr/src/slapt-src/slackbuilds_data
@@ -0,0 +1,20 @@
+SLACKBUILD NAME: abc
+SLACKBUILD SOURCEURL: http://www.slackware.org.uk/slackbuilds.org/13.37/
+SLACKBUILD LOCATION: libraries/abc/
+SLACKBUILD FILES: abc.SlackBuild slack-desc
+SLACKBUILD VERSION: 4
+SLACKBUILD DOWNLOAD: http://www.ufl.edu/abc-4.tar.gz
+SLACKBUILD MD5SUM: b3e9679ba20635ac4847f01c01d6e992
+SLACKBUILD REQUIRES:
+SLACKBUILD SHORT DESCRIPTION: abc is a small utility
+
+SLACKBUILD NAME: qwe
+SLACKBUILD SOURCEURL: http://www.slackware.org.uk/slackbuilds.org/13.37/
+SLACKBUILD LOCATION: network/qwe/
+SLACKBUILD FILES: qwe.SlackBuild
+SLACKBUILD VERSION: 2.1
+SLACKBUILD DOWNLOAD: http://php.net/qwe-2.1.tgz
+SLACKBUILD MD5SUM: 1f7a58f850e795b0958a3f99ae8c2cc4
+SLACKBUILD REQUIRES:
+SLACKBUILD SHORT DESCRIPTION: qwe is a program
+
diff --git a/test/fixtures/slackware/var/log/packages/radeontool-1.6.1-i486-1 b/test/fixtures/slackware/var/log/packages/radeontool-1.6.1-i486-1
new file mode 100644
index 00000000..7f53326b
--- /dev/null
+++ b/test/fixtures/slackware/var/log/packages/radeontool-1.6.1-i486-1
@@ -0,0 +1,24 @@
+PACKAGE NAME: radeontool-1.6.1-i486-1
+COMPRESSED PACKAGE SIZE: 48K
+UNCOMPRESSED PACKAGE SIZE: 150K
+PACKAGE LOCATION: ./radeontool-1.6.1-i486-1.txz
+PACKAGE DESCRIPTION:
+radeontool: radeontool (small utility for ati radeon-based laptops)
+radeontool:
+radeontool: Radeontool is a small utility to control ATI Radeon-based
+radeontool: laptops' backlight and external output functions
+radeontool:
+radeontool: Homepage: http://fdd.com/software/radeon/
+radeontool:
+radeontool:
+radeontool:
+radeontool:
+radeontool:
+FILE LIST:
+./
+usr/
+usr/bin/
+usr/bin/radeontool
+usr/bin/avivotool
+install/
+install/slack-desc
diff --git a/test/fixtures/slackware/var/log/packages/rzip-2.1-i486-1 b/test/fixtures/slackware/var/log/packages/rzip-2.1-i486-1
new file mode 100644
index 00000000..0fa71f40
--- /dev/null
+++ b/test/fixtures/slackware/var/log/packages/rzip-2.1-i486-1
@@ -0,0 +1,29 @@
+PACKAGE NAME: rzip-2.1-i486-1
+COMPRESSED PACKAGE SIZE: 20K
+UNCOMPRESSED PACKAGE SIZE: 50K
+PACKAGE LOCATION: ./rzip-2.1-i486-1.txz
+PACKAGE DESCRIPTION:
+rzip: rzip (a large-file compression program)
+rzip:
+rzip: rzip is a file compression program designed to do particularly well
+rzip: on very large files containing long distance redundancy.
+rzip:
+rzip: rzip was written by Andrew Tridgell.
+rzip:
+rzip:
+rzip:
+rzip:
+rzip:
+FILE LIST:
+./
+bin/
+bin/rzip
+usr/
+usr/doc/
+usr/doc/rzip-2.1/
+usr/doc/rzip-2.1/COPYING
+usr/man/
+usr/man/man1/
+usr/man/man1/rzip.1.gz
+install/
+install/slack-desc
diff --git a/test/fixtures/slackware/var/slapt-get/package_data b/test/fixtures/slackware/var/slapt-get/package_data
new file mode 100644
index 00000000..410fc3d1
--- /dev/null
+++ b/test/fixtures/slackware/var/slapt-get/package_data
@@ -0,0 +1,47 @@
+PACKAGE NAME: abc-4-i686-1.txz
+PACKAGE MIRROR: http://slackware.com/
+PACKAGE PRIORITY: 2
+PACKAGE LOCATION: ./slackware/ap
+PACKAGE SIZE (compressed): 48 K
+PACKAGE SIZE (uncompressed): 150 K
+PACKAGE REQUIRED:
+PACKAGE CONFLICTS:
+PACKAGE SUGGESTS:
+PACKAGE MD5SUM: 53e873df10b9e343a5c58721f10b9131
+PACKAGE DESCRIPTION:
+abc: abc (small utility)
+abc:
+abc: abc is a small utility
+abc:
+
+PACKAGE NAME: ran-1.2-noarch-1.txz
+PACKAGE MIRROR: http://slackware.com/
+PACKAGE PRIORITY: 2
+PACKAGE LOCATION: ./slackware/x
+PACKAGE SIZE (compressed): 36 K
+PACKAGE SIZE (uncompressed): 160 K
+PACKAGE REQUIRED:
+PACKAGE CONFLICTS:
+PACKAGE SUGGESTS:
+PACKAGE MD5SUM: cefa3f087e10f8371d68bea94a829ef8
+PACKAGE DESCRIPTION:
+ran: ran
+ran:
+ran: ran is part of X11.
+ran:
+
+PACKAGE NAME: qwe-2.1-i486-1.txz
+PACKAGE MIRROR: http://slackware.com/
+PACKAGE PRIORITY: 1
+PACKAGE LOCATION: ./slackware/ap
+PACKAGE SIZE (compressed): 20 K
+PACKAGE SIZE (uncompressed): 50 K
+PACKAGE REQUIRED:
+PACKAGE CONFLICTS:
+PACKAGE SUGGESTS:
+PACKAGE MD5SUM: 1a8fe22cb924cde3dc95c89689b20ee3
+PACKAGE DESCRIPTION:
+qwe: qwe
+qwe:
+qwe: qwe is a program
+qwe:
diff --git a/test/lib/completions/a2x.exp b/test/lib/completions/a2x.exp
new file mode 100644
index 00000000..e1ca8844
--- /dev/null
+++ b/test/lib/completions/a2x.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "a2x "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ant.exp b/test/lib/completions/ant.exp
index de57f24a..acff23ec 100644
--- a/test/lib/completions/ant.exp
+++ b/test/lib/completions/ant.exp
@@ -4,7 +4,9 @@ proc setup {} {
proc teardown {} {
- assert_env_unmodified
+ assert_env_unmodified {
+ /OLDPWD=/d
+ }
}
@@ -12,8 +14,10 @@ setup
assert_complete_any "ant -"
+sync_after_int
+assert_complete_dir "bashcomp clean init realclean" "ant " $::srcdir/fixtures/ant
sync_after_int
diff --git a/test/lib/completions/arping.exp b/test/lib/completions/arping.exp
new file mode 100644
index 00000000..531bb07f
--- /dev/null
+++ b/test/lib/completions/arping.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "arping "
+sync_after_int
+
+assert_complete_any "arping -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/asciidoc.exp b/test/lib/completions/asciidoc.exp
new file mode 100644
index 00000000..86e7609a
--- /dev/null
+++ b/test/lib/completions/asciidoc.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "asciidoc "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/avctrl.exp b/test/lib/completions/avctrl.exp
new file mode 100644
index 00000000..6ca9de70
--- /dev/null
+++ b/test/lib/completions/avctrl.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "avctrl "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/base64.exp b/test/lib/completions/base64.exp
new file mode 100644
index 00000000..1f3f35cf
--- /dev/null
+++ b/test/lib/completions/base64.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "base64 "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/c++.exp b/test/lib/completions/c++.exp
index 4dffb042..c899de27 100644
--- a/test/lib/completions/c++.exp
+++ b/test/lib/completions/c++.exp
@@ -11,7 +11,6 @@ proc teardown {} {
setup
-set test "Tab should complete"
assert_complete_any "c++ "
diff --git a/test/lib/completions/cal.exp b/test/lib/completions/cal.exp
new file mode 100644
index 00000000..bf7185e2
--- /dev/null
+++ b/test/lib/completions/cal.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "cal "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cfagent.exp b/test/lib/completions/cfagent.exp
new file mode 100644
index 00000000..aa5c88cb
--- /dev/null
+++ b/test/lib/completions/cfagent.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "cfagent -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/chage.exp b/test/lib/completions/chage.exp
new file mode 100644
index 00000000..e5399054
--- /dev/null
+++ b/test/lib/completions/chage.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "chage "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/chown.exp b/test/lib/completions/chown.exp
index bc1a8c7f..6bfd9d05 100644
--- a/test/lib/completions/chown.exp
+++ b/test/lib/completions/chown.exp
@@ -69,5 +69,11 @@ if {!$failed_find_unique_completion} {
sync_after_int
}
+assert_complete {bar "bar bar.d/" foo foo.d/} "chown foo: $::srcdir/fixtures/shared/default/"
+sync_after_int
+
+assert_complete {bar "bar bar.d/" foo foo.d/} "chown :foo $::srcdir/fixtures/shared/default/"
+sync_after_int
+
teardown
diff --git a/test/lib/completions/chpasswd.exp b/test/lib/completions/chpasswd.exp
new file mode 100644
index 00000000..84c3345f
--- /dev/null
+++ b/test/lib/completions/chpasswd.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "chpasswd -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/chrpath.exp b/test/lib/completions/chrpath.exp
new file mode 100644
index 00000000..311628eb
--- /dev/null
+++ b/test/lib/completions/chrpath.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "chrpath "
+sync_after_int
+
+assert_complete_any "chrpath -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/chsh.exp b/test/lib/completions/chsh.exp
index a26ac93f..6736c18c 100644
--- a/test/lib/completions/chsh.exp
+++ b/test/lib/completions/chsh.exp
@@ -17,7 +17,7 @@ assert_complete_any "chsh -s "
sync_after_int
-assert_complete [exec bash -c "compgen -A user"] "chsh "
+assert_complete_any "chsh "
sync_after_int
diff --git a/test/lib/completions/ciptool.exp b/test/lib/completions/ciptool.exp
new file mode 100644
index 00000000..cefe8f92
--- /dev/null
+++ b/test/lib/completions/ciptool.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ciptool "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/compare.exp b/test/lib/completions/compare.exp
new file mode 100644
index 00000000..006d70a1
--- /dev/null
+++ b/test/lib/completions/compare.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "compare "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/conjure.exp b/test/lib/completions/conjure.exp
new file mode 100644
index 00000000..4f628af3
--- /dev/null
+++ b/test/lib/completions/conjure.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "conjure "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/convert.exp b/test/lib/completions/convert.exp
index 07032040..b3a2e565 100644
--- a/test/lib/completions/convert.exp
+++ b/test/lib/completions/convert.exp
@@ -12,8 +12,10 @@ setup
assert_complete_any "convert "
+sync_after_int
+assert_complete_any "convert -format "
sync_after_int
diff --git a/test/lib/completions/cppcheck.exp b/test/lib/completions/cppcheck.exp
new file mode 100644
index 00000000..4acd709a
--- /dev/null
+++ b/test/lib/completions/cppcheck.exp
@@ -0,0 +1,30 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "cppcheck "
+sync_after_int
+
+
+assert_complete_any "cppcheck -"
+sync_after_int
+
+
+assert_complete_any "cppcheck -DFOO=BAR "
+sync_after_int
+
+
+assert_no_complete "cppcheck -D "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/curl.exp b/test/lib/completions/curl.exp
new file mode 100644
index 00000000..53512bc4
--- /dev/null
+++ b/test/lib/completions/curl.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "curl -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/cvs.exp b/test/lib/completions/cvs.exp
index 3b2643d3..9248edc8 100644
--- a/test/lib/completions/cvs.exp
+++ b/test/lib/completions/cvs.exp
@@ -8,6 +8,7 @@ proc teardown {} {
assert_bash_exec {HOME=$OLDHOME}
assert_env_unmodified {
/OLDHOME=/d
+ /OLDPWD=/d
}
}
@@ -33,4 +34,8 @@ expect {
sync_after_int
+assert_complete_dir "foo/bar" "cvs diff foo/" $::srcdir/fixtures/cvs
+sync_after_int
+
+
teardown
diff --git a/test/lib/completions/dfutool.exp b/test/lib/completions/dfutool.exp
new file mode 100644
index 00000000..10e48544
--- /dev/null
+++ b/test/lib/completions/dfutool.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "dfutool "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/display.exp b/test/lib/completions/display.exp
index e9fe766a..70cea182 100644
--- a/test/lib/completions/display.exp
+++ b/test/lib/completions/display.exp
@@ -17,22 +17,7 @@ assert_complete_any "display "
sync_after_int
-set test "- should complete options"
-set options {
- -alpha -antialias -authenticate -auto-orient -backdrop -background -border
- -bordercolor -borderwidth -channel -clip -clip-path -coalesce -colormap
- -colors -colorspace -comment -compress -contrast -crop -debug -decipher
- -define -delay -density -depth -despeckle -display -dispose -dither -edge
- -endian -enhance -extract -filter -flatten -flip -flop -font -foreground
- -format -frame -gamma -geometry -help -iconGeometry -iconic -identify
- -immutable -interlace -interpolate -label -limit -list -log -loop -map
- -mattecolor -monitor -monochrome -name -negate -page -profile -quality
- -quantize -quiet -raise -regard-warnings -remote -repage -resample -resize
- -respect-parenthesis -roll -rotate -sample -sampling-factor -scenes -seed
- -segment -set -shared-memory -sharpen -size -strip -texture -title
- -transparent-color -treedepth -trim -update -usePixmap -verbose -version
- -virtual-pixel -visual -window -window-group -write }
-assert_complete $options "display -" $test
+assert_complete_any "display -"
sync_after_int
diff --git a/test/lib/completions/dmesg.exp b/test/lib/completions/dmesg.exp
new file mode 100644
index 00000000..79f2e04a
--- /dev/null
+++ b/test/lib/completions/dmesg.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "dmesg -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dot.exp b/test/lib/completions/dot.exp
new file mode 100644
index 00000000..2a85a56b
--- /dev/null
+++ b/test/lib/completions/dot.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "dot "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/explodepkg.exp b/test/lib/completions/explodepkg.exp
new file mode 100644
index 00000000..e5ee35e4
--- /dev/null
+++ b/test/lib/completions/explodepkg.exp
@@ -0,0 +1,25 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}
+
+
+setup
+
+
+set test "should complete *.t\[gbxl\]z files and dirs"
+set dir $::srcdir/fixtures/slackware/home
+set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \
+ \\( -type d -printf '%P/\\n' \\) -o \
+ \\( -type f -name '*.t\[bglx\]z' -printf '%P\\n' \\)"] "\n"]
+assert_complete_dir $files "explodepkg " $dir $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/faillog.exp b/test/lib/completions/faillog.exp
new file mode 100644
index 00000000..9ccd1ad2
--- /dev/null
+++ b/test/lib/completions/faillog.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "faillog -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/fbgs.exp b/test/lib/completions/fbgs.exp
new file mode 100644
index 00000000..45fa22df
--- /dev/null
+++ b/test/lib/completions/fbgs.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "fbgs "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/fbi.exp b/test/lib/completions/fbi.exp
new file mode 100644
index 00000000..9c583062
--- /dev/null
+++ b/test/lib/completions/fbi.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "fbi "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/feh.exp b/test/lib/completions/feh.exp
new file mode 100644
index 00000000..129e1f4d
--- /dev/null
+++ b/test/lib/completions/feh.exp
@@ -0,0 +1,55 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "feh "
+
+
+sync_after_int
+
+
+set test "--lis<TAB> should complete \"--list\""
+assert_complete "--list" "feh --lis" $test
+
+
+sync_after_int
+
+
+set test "-S pix<TAB> should complete \"pixels\""
+assert_complete "pixels" "feh -S pix" $test
+
+
+sync_after_int
+
+
+set test "--zoom ma<TAB> should complete \"max\""
+assert_complete "max" "feh --zoom ma" $test
+
+
+sync_after_int
+
+
+set test "-g 640<TAB> should complete digits plus \"x\""
+assert_complete "0 1 2 3 4 5 6 7 8 9 x" "feh -g 640" $test
+
+
+sync_after_int
+
+
+set test "-g 640x48<TAB> should complete digits"
+assert_complete "0 1 2 3 4 5 6 7 8 9" "feh -g 640x48" $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/file.exp b/test/lib/completions/file.exp
new file mode 100644
index 00000000..346960b6
--- /dev/null
+++ b/test/lib/completions/file.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "file "
+sync_after_int
+
+assert_complete_any "file -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/find.exp b/test/lib/completions/find.exp
index 9acda648..96d55334 100644
--- a/test/lib/completions/find.exp
+++ b/test/lib/completions/find.exp
@@ -43,7 +43,7 @@ sync_after_int
set test "-wholename should complete files/dirs"
set dir $::srcdir/fixtures/shared/default
set files [split [exec bash -c "cd $dir && ls -p"] "\n"]
-assert_complete_dir $files "find -wholename " $dir
+assert_complete_dir $files "find -wholename " $dir $test
sync_after_int
diff --git a/test/lib/completions/finger.exp b/test/lib/completions/finger.exp
index 70e3ed2c..f11d11fe 100644
--- a/test/lib/completions/finger.exp
+++ b/test/lib/completions/finger.exp
@@ -24,7 +24,7 @@ sync_after_int
set test "Tab should complete partial username"
-assert_complete_partial [exec bash -c "compgen -A user"] "finger" -nospace
+assert_complete_partial [exec bash -c "compgen -A user"] "finger" "" $test -nospace
sync_after_int
@@ -48,7 +48,7 @@ foreach h [get_known_hosts] {
}
}
}
-assert_complete $hosts "finger test@$char" $test
+assert_complete $hosts "finger test@$char" $test -expect-cmd-minus "test@$char"
sync_after_int
diff --git a/test/lib/completions/fusermount.exp b/test/lib/completions/fusermount.exp
new file mode 100644
index 00000000..f6ac4f5d
--- /dev/null
+++ b/test/lib/completions/fusermount.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "fusermount "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gendiff.exp b/test/lib/completions/gendiff.exp
new file mode 100644
index 00000000..cc1ebb68
--- /dev/null
+++ b/test/lib/completions/gendiff.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "gendiff "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gnome-mplayer.exp b/test/lib/completions/gnome-mplayer.exp
new file mode 100644
index 00000000..fd635bff
--- /dev/null
+++ b/test/lib/completions/gnome-mplayer.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "gnome-mplayer "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gpasswd.exp b/test/lib/completions/gpasswd.exp
new file mode 100644
index 00000000..68ac2cc3
--- /dev/null
+++ b/test/lib/completions/gpasswd.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "gpasswd "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/grpck.exp b/test/lib/completions/grpck.exp
new file mode 100644
index 00000000..385ebe2b
--- /dev/null
+++ b/test/lib/completions/grpck.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "grpck "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/hciattach.exp b/test/lib/completions/hciattach.exp
new file mode 100644
index 00000000..35642f28
--- /dev/null
+++ b/test/lib/completions/hciattach.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "hciattach "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/hciconfig.exp b/test/lib/completions/hciconfig.exp
new file mode 100644
index 00000000..56444f4f
--- /dev/null
+++ b/test/lib/completions/hciconfig.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "hciconfig "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/hddtemp.exp b/test/lib/completions/hddtemp.exp
new file mode 100644
index 00000000..a6721dbf
--- /dev/null
+++ b/test/lib/completions/hddtemp.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "hddtemp -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/host.exp b/test/lib/completions/host.exp
new file mode 100644
index 00000000..73081821
--- /dev/null
+++ b/test/lib/completions/host.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "host -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/htpasswd.exp b/test/lib/completions/htpasswd.exp
new file mode 100644
index 00000000..bb66d2f0
--- /dev/null
+++ b/test/lib/completions/htpasswd.exp
@@ -0,0 +1,32 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified {
+ /OLDPWD=/d
+ }
+}
+
+
+setup
+
+
+assert_complete_any "htpasswd "
+sync_after_int
+
+
+assert_no_complete "htpasswd -n $::srcdir/fixtures/htpasswd/ht"
+sync_after_int
+
+
+assert_complete_dir "htpasswd" "htpasswd " $::srcdir/fixtures/htpasswd
+sync_after_int
+
+
+assert_complete_dir "foo quux" "htpasswd -D htpasswd " $::srcdir/fixtures/htpasswd
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/idn.exp b/test/lib/completions/idn.exp
new file mode 100644
index 00000000..4625c7e4
--- /dev/null
+++ b/test/lib/completions/idn.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "idn -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/import.exp b/test/lib/completions/import.exp
new file mode 100644
index 00000000..db6845ea
--- /dev/null
+++ b/test/lib/completions/import.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "import "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/installpkg.exp b/test/lib/completions/installpkg.exp
new file mode 100644
index 00000000..48581aa1
--- /dev/null
+++ b/test/lib/completions/installpkg.exp
@@ -0,0 +1,49 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}
+
+
+setup
+
+
+assert_complete_any "installpkg -"
+
+
+sync_after_int
+
+
+set test "--<TAB> should complete all long options"
+set options [list --warn --md5sum --root --infobox --terse --menu --ask \
+ --priority --tagfile]
+assert_complete $options "installpkg --" $test
+
+
+sync_after_int
+
+
+set test "--root should comlete only dirs"
+set dirs [split [exec bash -c "find . -type d -mindepth 1 -maxdepth 1 \
+ -printf '%P/\n'"] "\n"]
+assert_complete $dirs "installpkg --root " $test
+
+
+sync_after_int
+
+
+set test "should complete *.t\[gbxl\]z files and dirs"
+set dir $::srcdir/fixtures/slackware/home
+set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \
+ \\( -type d -printf '%P/\\n' \\) -o \
+ \\( -type f -name '*.t\[bglx\]z' -printf '%P\\n' \\)"] "\n"]
+assert_complete_dir $files "installpkg " $dir $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ionice.exp b/test/lib/completions/ionice.exp
new file mode 100644
index 00000000..d0ff8b64
--- /dev/null
+++ b/test/lib/completions/ionice.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ionice -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/java.exp b/test/lib/completions/java.exp
index 842501d2..864aabd6 100644
--- a/test/lib/completions/java.exp
+++ b/test/lib/completions/java.exp
@@ -18,14 +18,21 @@ assert_complete_any "java -"
sync_after_int
-assert_complete "b bashcomp.jarred toplevel" "java "
+assert_complete "b bashcomp.jarred c. toplevel" "java "
sync_after_int
assert_complete "bashcomp.jarred toplevel" \
- "java -cp $::srcdir/fixtures/java/bashcomp.jar "
+ "java -classpath $::srcdir/fixtures/java/bashcomp.jar "
+
+
+sync_after_int
+
+
+assert_complete "bashcomp.jarred d toplevel" \
+ "java -cp $::srcdir/fixtures/java/bashcomp.jar:$::srcdir/fixtures/java/a/c "
sync_after_int
diff --git a/test/lib/completions/javadoc.exp b/test/lib/completions/javadoc.exp
index 0af8a3da..79e86138 100644
--- a/test/lib/completions/javadoc.exp
+++ b/test/lib/completions/javadoc.exp
@@ -12,8 +12,14 @@ setup
assert_complete_any "javadoc "
+sync_after_int
+
+
+assert_complete {"bar bar.d/" foo.d/} "javadoc -linkoffline $::srcdir/fixtures/shared/default/"
+sync_after_int
+assert_complete {"bar bar.d/" foo.d/} "javadoc -nodeprecated -linkoffline foo $::srcdir/fixtures/shared/default/"
sync_after_int
diff --git a/test/lib/completions/jps.exp b/test/lib/completions/jps.exp
new file mode 100644
index 00000000..62d5d710
--- /dev/null
+++ b/test/lib/completions/jps.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "jps -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/kcov.exp b/test/lib/completions/kcov.exp
new file mode 100644
index 00000000..c39f53e7
--- /dev/null
+++ b/test/lib/completions/kcov.exp
@@ -0,0 +1,27 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "kcov "
+
+
+sync_after_int
+
+
+set test "--exclude-patter<TAB> should complete \"--exclude-pattern=\""
+assert_complete "--exclude-pattern=" "kcov --exclude-patter" $test -nospace
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/kill.exp b/test/lib/completions/kill.exp
index 1e80fe69..bc07bc48 100644
--- a/test/lib/completions/kill.exp
+++ b/test/lib/completions/kill.exp
@@ -12,14 +12,16 @@ setup
assert_complete_any "kill 1"
-
-
sync_after_int
-assert_complete [get_signals] "kill -"
+assert_complete [get_signals] "kill -s "
+sync_after_int
+set expected [get_signals -]
+lappend expected "-l" "-s"
+assert_complete [lsort -unique $expected] "kill -"
sync_after_int
diff --git a/test/lib/completions/killall.exp b/test/lib/completions/killall.exp
index ae8b3d60..1ee3ade8 100644
--- a/test/lib/completions/killall.exp
+++ b/test/lib/completions/killall.exp
@@ -17,7 +17,7 @@ assert_complete_any "killall "
sync_after_int
-assert_complete [get_signals] "killall -"
+assert_complete [get_signals -] "killall -"
sync_after_int
diff --git a/test/lib/completions/l2ping.exp b/test/lib/completions/l2ping.exp
new file mode 100644
index 00000000..de8c58c1
--- /dev/null
+++ b/test/lib/completions/l2ping.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "l2ping -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lastlog.exp b/test/lib/completions/lastlog.exp
new file mode 100644
index 00000000..74d75553
--- /dev/null
+++ b/test/lib/completions/lastlog.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "lastlog -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldapadd.exp b/test/lib/completions/ldapadd.exp
new file mode 100644
index 00000000..bc066ab6
--- /dev/null
+++ b/test/lib/completions/ldapadd.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ldapadd -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldapcompare.exp b/test/lib/completions/ldapcompare.exp
new file mode 100644
index 00000000..c693f703
--- /dev/null
+++ b/test/lib/completions/ldapcompare.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ldapcompare -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldapdelete.exp b/test/lib/completions/ldapdelete.exp
new file mode 100644
index 00000000..cc20d0e7
--- /dev/null
+++ b/test/lib/completions/ldapdelete.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ldapdelete -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldapmodrdn.exp b/test/lib/completions/ldapmodrdn.exp
new file mode 100644
index 00000000..3ae6c399
--- /dev/null
+++ b/test/lib/completions/ldapmodrdn.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ldapmodrdn -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldappasswd.exp b/test/lib/completions/ldappasswd.exp
new file mode 100644
index 00000000..2dd49393
--- /dev/null
+++ b/test/lib/completions/ldappasswd.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ldappasswd -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldapsearch.exp b/test/lib/completions/ldapsearch.exp
new file mode 100644
index 00000000..92394ecd
--- /dev/null
+++ b/test/lib/completions/ldapsearch.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ldapsearch -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldapvi.exp b/test/lib/completions/ldapvi.exp
new file mode 100644
index 00000000..54c62772
--- /dev/null
+++ b/test/lib/completions/ldapvi.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ldapvi -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ldapwhoami.exp b/test/lib/completions/ldapwhoami.exp
new file mode 100644
index 00000000..7be41740
--- /dev/null
+++ b/test/lib/completions/ldapwhoami.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ldapwhoami -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lpq.exp b/test/lib/completions/lpq.exp
new file mode 100644
index 00000000..41fdb216
--- /dev/null
+++ b/test/lib/completions/lpq.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "lpq "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lpr.exp b/test/lib/completions/lpr.exp
new file mode 100644
index 00000000..1ec46844
--- /dev/null
+++ b/test/lib/completions/lpr.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "lpr "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/lvchange.exp b/test/lib/completions/lvchange.exp
index 6587a260..2240e5eb 100644
--- a/test/lib/completions/lvchange.exp
+++ b/test/lib/completions/lvchange.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvchange --"
+if {[assert_exec {lvchange --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvchange --"
+}
sync_after_int
diff --git a/test/lib/completions/lvcreate.exp b/test/lib/completions/lvcreate.exp
index 91cb0d81..678ac1be 100644
--- a/test/lib/completions/lvcreate.exp
+++ b/test/lib/completions/lvcreate.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvcreate --"
+if {[assert_exec {lvcreate --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvcreate --"
+}
sync_after_int
diff --git a/test/lib/completions/lvdisplay.exp b/test/lib/completions/lvdisplay.exp
index 6fa9c294..5e8c3210 100644
--- a/test/lib/completions/lvdisplay.exp
+++ b/test/lib/completions/lvdisplay.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvdisplay --"
+if {[assert_exec {lvdisplay --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvdisplay --"
+}
sync_after_int
diff --git a/test/lib/completions/lvextend.exp b/test/lib/completions/lvextend.exp
index ded34695..7c0e329e 100644
--- a/test/lib/completions/lvextend.exp
+++ b/test/lib/completions/lvextend.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvextend --"
+if {[assert_exec {lvextend --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvextend --"
+}
sync_after_int
diff --git a/test/lib/completions/lvmdiskscan.exp b/test/lib/completions/lvmdiskscan.exp
index 6553865f..30c73c5c 100644
--- a/test/lib/completions/lvmdiskscan.exp
+++ b/test/lib/completions/lvmdiskscan.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvmdiskscan --"
+if {[assert_exec {lvmdiskscan --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvmdiskscan --"
+}
sync_after_int
diff --git a/test/lib/completions/lvreduce.exp b/test/lib/completions/lvreduce.exp
index e2708f89..b9904fef 100644
--- a/test/lib/completions/lvreduce.exp
+++ b/test/lib/completions/lvreduce.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvreduce --"
+if {[assert_exec {lvreduce --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvreduce --"
+}
sync_after_int
diff --git a/test/lib/completions/lvremove.exp b/test/lib/completions/lvremove.exp
index 8ca1517b..0f41d8dc 100644
--- a/test/lib/completions/lvremove.exp
+++ b/test/lib/completions/lvremove.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvremove --"
+if {[assert_exec {lvremove --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvremove --"
+}
sync_after_int
diff --git a/test/lib/completions/lvrename.exp b/test/lib/completions/lvrename.exp
index 17179ce9..77d6c5e0 100644
--- a/test/lib/completions/lvrename.exp
+++ b/test/lib/completions/lvrename.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvrename --"
+if {[assert_exec {lvrename --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvrename --"
+}
sync_after_int
diff --git a/test/lib/completions/lvresize.exp b/test/lib/completions/lvresize.exp
index 2b3e1044..a0e8f99e 100644
--- a/test/lib/completions/lvresize.exp
+++ b/test/lib/completions/lvresize.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvresize --"
+if {[assert_exec {lvresize --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvresize --"
+}
sync_after_int
diff --git a/test/lib/completions/lvs.exp b/test/lib/completions/lvs.exp
index e531f7e9..c46a8153 100644
--- a/test/lib/completions/lvs.exp
+++ b/test/lib/completions/lvs.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvs --"
+if {[assert_exec {lvs --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvs --"
+}
sync_after_int
diff --git a/test/lib/completions/lvscan.exp b/test/lib/completions/lvscan.exp
index 7b09e5e1..60effb5d 100644
--- a/test/lib/completions/lvscan.exp
+++ b/test/lib/completions/lvscan.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "lvscan --"
+if {[assert_exec {lvscan --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "lvscan --"
+}
sync_after_int
diff --git a/test/lib/completions/makepkg.exp b/test/lib/completions/makepkg.exp
new file mode 100644
index 00000000..56e06339
--- /dev/null
+++ b/test/lib/completions/makepkg.exp
@@ -0,0 +1,28 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "makepkg -"
+
+
+sync_after_int
+
+
+set test "--<TAB> should complete all long options"
+set options [list --linkadd --prepend --chown]
+assert_complete $options "makepkg --" $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mdadm.exp b/test/lib/completions/mdadm.exp
new file mode 100644
index 00000000..6559aa20
--- /dev/null
+++ b/test/lib/completions/mdadm.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "mdadm "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mdtool.exp b/test/lib/completions/mdtool.exp
new file mode 100644
index 00000000..076cb17a
--- /dev/null
+++ b/test/lib/completions/mdtool.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "mdtool "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/medusa.exp b/test/lib/completions/medusa.exp
new file mode 100644
index 00000000..6ad2fdc3
--- /dev/null
+++ b/test/lib/completions/medusa.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "medusa -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mii-diag.exp b/test/lib/completions/mii-diag.exp
new file mode 100644
index 00000000..952ff632
--- /dev/null
+++ b/test/lib/completions/mii-diag.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "mii-diag "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mii-tool.exp b/test/lib/completions/mii-tool.exp
new file mode 100644
index 00000000..03827edd
--- /dev/null
+++ b/test/lib/completions/mii-tool.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "mii-tool "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mkdir.exp b/test/lib/completions/mkdir.exp
index 8d8c881d..44e87cee 100644
--- a/test/lib/completions/mkdir.exp
+++ b/test/lib/completions/mkdir.exp
@@ -23,4 +23,11 @@ assert_complete {"bar bar.d/" foo.d/} "mkdir $::srcdir/fixtures/shared/default/"
sync_after_int
+# No subdirs in foo.d and should not complete files in it (_longopt()).
+assert_no_complete "mkdir $::srcdir/fixtures/shared/default/foo.d/"
+
+
+sync_after_int
+
+
teardown
diff --git a/test/lib/completions/monodevelop.exp b/test/lib/completions/monodevelop.exp
new file mode 100644
index 00000000..0bfe788e
--- /dev/null
+++ b/test/lib/completions/monodevelop.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "monodevelop "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mount.exp b/test/lib/completions/mount.exp
index c99d6058..1298f36f 100644
--- a/test/lib/completions/mount.exp
+++ b/test/lib/completions/mount.exp
@@ -30,7 +30,7 @@ proc setup {} {
proc teardown {} {
teardown_dummy_mnt
- assert_env_unmodified
+ assert_env_unmodified {/OLDPWD/d}
}
@@ -49,6 +49,13 @@ assert_complete_any "mount -t "
sync_after_int
+set test "mount /dev/sda1 def should complete directory name"
+assert_complete_dir "default/" "mount /dev/sda1 def" $::srcdir/fixtures/shared $test -nospace
+
+
+sync_after_int
+
+
set test "Check completing nfs mounts"
set expected [list /test/path /test/path2 /second/path]
set cmd "mount mocksrv:/"
diff --git a/test/lib/completions/msynctool.exp b/test/lib/completions/msynctool.exp
new file mode 100644
index 00000000..cb238d9f
--- /dev/null
+++ b/test/lib/completions/msynctool.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "msynctool "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/mutt.exp b/test/lib/completions/mutt.exp
index 8cb8b0c6..1f4425e2 100644
--- a/test/lib/completions/mutt.exp
+++ b/test/lib/completions/mutt.exp
@@ -1,10 +1,15 @@
proc setup {} {
save_env
+ assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIRABS/fixtures/mutt}
}
proc teardown {} {
- assert_env_unmodified {/OLDPWD=/d}
+ assert_bash_exec {HOME=$OLDHOME}
+ assert_env_unmodified {
+ /OLDPWD=/d
+ /OLDHOME=/d
+ }
}
@@ -19,15 +24,20 @@ sync_after_int
set test "mutt should complete mailboxes"
set expected {foo/ bar/ muttrc}
-assert_complete_dir $expected "mutt -F muttrc -f =" $::srcdir/fixtures/mutt
+assert_complete_dir $expected "mutt -F muttrc -f =" $::srcdir/fixtures/mutt $test
set test "mutt should complete aliases"
set expected {a1 a2}
-assert_complete_dir $expected "mutt -F muttrc -A " $::srcdir/fixtures/mutt
+assert_complete_dir $expected "mutt -F muttrc -A " $::srcdir/fixtures/mutt $test
sync_after_int
+set expected "$::srcdirabs/fixtures/mutt/muttrc $::srcdirabs/fixtures/mutt/bar/muttrc_b $::srcdirabs/fixtures/mutt/foo/muttrc_f"
+assert_bash_list $expected { _muttconffiles "$HOME/muttrc" "$HOME/muttrc" } "find muttrcs recursively"
+sync_after_int
+
+
teardown
diff --git a/test/lib/completions/mysql.exp b/test/lib/completions/mysql.exp
new file mode 100644
index 00000000..62a64fc2
--- /dev/null
+++ b/test/lib/completions/mysql.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "mysql --"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/newusers.exp b/test/lib/completions/newusers.exp
new file mode 100644
index 00000000..a1928120
--- /dev/null
+++ b/test/lib/completions/newusers.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "newusers "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/nslookup.exp b/test/lib/completions/nslookup.exp
new file mode 100644
index 00000000..20b84451
--- /dev/null
+++ b/test/lib/completions/nslookup.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "nslookup -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/openssl.exp b/test/lib/completions/openssl.exp
index 25fc1367..d1357002 100644
--- a/test/lib/completions/openssl.exp
+++ b/test/lib/completions/openssl.exp
@@ -25,4 +25,8 @@ expect {
sync_after_int
+assert_complete_any "openssl pkey -cipher "
+sync_after_int
+
+
teardown
diff --git a/test/lib/completions/passwd.exp b/test/lib/completions/passwd.exp
new file mode 100644
index 00000000..df2945b8
--- /dev/null
+++ b/test/lib/completions/passwd.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "passwd "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/perl.exp b/test/lib/completions/perl.exp
index 8cd6f957..f3a51841 100644
--- a/test/lib/completions/perl.exp
+++ b/test/lib/completions/perl.exp
@@ -86,7 +86,7 @@ set test "- should complete options"
set options {
-0 -a -c -C -d -D -e -F -h -i -I -l -m -M -n -p -P -s -S -T -u -U -v -V -w -W -x -X
}
-assert_complete $options "perl -"
+assert_complete $options "perl -" $test
sync_after_int
diff --git a/test/lib/completions/perldoc.exp b/test/lib/completions/perldoc.exp
index dc1c79c8..9a9d9fbf 100644
--- a/test/lib/completions/perldoc.exp
+++ b/test/lib/completions/perldoc.exp
@@ -32,7 +32,7 @@ set test "- should complete options"
set options {
-h -v -t -u -m -l -F -X -f -q
}
-assert_complete $options "perldoc -"
+assert_complete $options "perldoc -" $test
sync_after_int
diff --git a/test/lib/completions/phing.exp b/test/lib/completions/phing.exp
new file mode 100644
index 00000000..f064ea4a
--- /dev/null
+++ b/test/lib/completions/phing.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "phing -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pinfo.exp b/test/lib/completions/pinfo.exp
new file mode 100644
index 00000000..3af44044
--- /dev/null
+++ b/test/lib/completions/pinfo.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pinfo "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ping.exp b/test/lib/completions/ping.exp
index 3e419966..9ef7f2fd 100644
--- a/test/lib/completions/ping.exp
+++ b/test/lib/completions/ping.exp
@@ -12,8 +12,9 @@ setup
assert_complete_any "ping "
+sync_after_int
-
+assert_complete_any "ping -"
sync_after_int
diff --git a/test/lib/completions/pkgtool.exp b/test/lib/completions/pkgtool.exp
new file mode 100644
index 00000000..c071ecd4
--- /dev/null
+++ b/test/lib/completions/pkgtool.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pkgtool -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/postcat.exp b/test/lib/completions/postcat.exp
new file mode 100644
index 00000000..78636676
--- /dev/null
+++ b/test/lib/completions/postcat.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "postcat "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/postconf.exp b/test/lib/completions/postconf.exp
new file mode 100644
index 00000000..40349061
--- /dev/null
+++ b/test/lib/completions/postconf.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "postconf p"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/postfix.exp b/test/lib/completions/postfix.exp
new file mode 100644
index 00000000..d1cb7e80
--- /dev/null
+++ b/test/lib/completions/postfix.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "postfix "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/postmap.exp b/test/lib/completions/postmap.exp
new file mode 100644
index 00000000..af31061f
--- /dev/null
+++ b/test/lib/completions/postmap.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "postmap "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/postsuper.exp b/test/lib/completions/postsuper.exp
new file mode 100644
index 00000000..145895e2
--- /dev/null
+++ b/test/lib/completions/postsuper.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "postsuper "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/prelink.exp b/test/lib/completions/prelink.exp
new file mode 100644
index 00000000..4a493667
--- /dev/null
+++ b/test/lib/completions/prelink.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "prelink "
+sync_after_int
+
+assert_complete_any "prelink -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/protoc.exp b/test/lib/completions/protoc.exp
new file mode 100644
index 00000000..caeb8274
--- /dev/null
+++ b/test/lib/completions/protoc.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "protoc "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/puppet.exp b/test/lib/completions/puppet.exp
new file mode 100644
index 00000000..7b7da3e7
--- /dev/null
+++ b/test/lib/completions/puppet.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "puppet "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pvchange.exp b/test/lib/completions/pvchange.exp
index a43ae9cd..f317b52f 100644
--- a/test/lib/completions/pvchange.exp
+++ b/test/lib/completions/pvchange.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "pvchange --"
+if {[assert_exec {pvchange --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "pvchange --"
+}
sync_after_int
diff --git a/test/lib/completions/pvcreate.exp b/test/lib/completions/pvcreate.exp
index 6bc9d4eb..6e36b368 100644
--- a/test/lib/completions/pvcreate.exp
+++ b/test/lib/completions/pvcreate.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "pvcreate --"
+if {[assert_exec {pvcreate --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "pvcreate --"
+}
sync_after_int
diff --git a/test/lib/completions/pvdisplay.exp b/test/lib/completions/pvdisplay.exp
index b9db558b..7b1df0c3 100644
--- a/test/lib/completions/pvdisplay.exp
+++ b/test/lib/completions/pvdisplay.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "pvdisplay --"
+if {[assert_exec {pvdisplay --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "pvdisplay --"
+}
sync_after_int
diff --git a/test/lib/completions/pvremove.exp b/test/lib/completions/pvremove.exp
index 1febcf37..6d655e79 100644
--- a/test/lib/completions/pvremove.exp
+++ b/test/lib/completions/pvremove.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "pvremove --"
+if {[assert_exec {pvremove --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "pvremove --"
+}
sync_after_int
diff --git a/test/lib/completions/pvs.exp b/test/lib/completions/pvs.exp
index e50501a3..195665fd 100644
--- a/test/lib/completions/pvs.exp
+++ b/test/lib/completions/pvs.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "pvs --"
+if {[assert_exec {pvs --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "pvs --"
+}
sync_after_int
diff --git a/test/lib/completions/pwck.exp b/test/lib/completions/pwck.exp
new file mode 100644
index 00000000..e7c5706c
--- /dev/null
+++ b/test/lib/completions/pwck.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pwck "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pwdx.exp b/test/lib/completions/pwdx.exp
new file mode 100644
index 00000000..314623bd
--- /dev/null
+++ b/test/lib/completions/pwdx.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pwdx "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pwgen.exp b/test/lib/completions/pwgen.exp
new file mode 100644
index 00000000..b8882b68
--- /dev/null
+++ b/test/lib/completions/pwgen.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pwgen -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/qemu.exp b/test/lib/completions/qemu.exp
new file mode 100644
index 00000000..cd3d5938
--- /dev/null
+++ b/test/lib/completions/qemu.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "qemu "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/quota.exp b/test/lib/completions/quota.exp
new file mode 100644
index 00000000..1eb9f161
--- /dev/null
+++ b/test/lib/completions/quota.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "quota "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/quotacheck.exp b/test/lib/completions/quotacheck.exp
new file mode 100644
index 00000000..4200da32
--- /dev/null
+++ b/test/lib/completions/quotacheck.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "quotacheck "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/quotaon.exp b/test/lib/completions/quotaon.exp
new file mode 100644
index 00000000..4acc70e1
--- /dev/null
+++ b/test/lib/completions/quotaon.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "quotaon "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rdesktop.exp b/test/lib/completions/rdesktop.exp
new file mode 100644
index 00000000..32544941
--- /dev/null
+++ b/test/lib/completions/rdesktop.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "rdesktop -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/removepkg.exp b/test/lib/completions/removepkg.exp
index 882f1e70..b7cf4b1c 100644
--- a/test/lib/completions/removepkg.exp
+++ b/test/lib/completions/removepkg.exp
@@ -4,14 +4,29 @@ proc setup {} {
proc teardown {} {
- assert_env_unmodified
+ assert_env_unmodified {/ROOT=/d}
}
setup
-assert_complete_any "removepkg "
+set test "-<TAB> should complete all options"
+set options [list -copy -keep -preserve -warn]
+assert_complete $options "removepkg -" $test
+
+
+sync_after_int
+
+
+set test "should complete files in \$ROOT/var/log/packages/"
+# set env(ROOT) [file normalize $::srcdir/fixtures/slackware]
+# set dir $env(ROOT)/var/log/packages/
+set root [file normalize $::srcdir/fixtures/slackware]
+set dir $root/var/log/packages/
+assert_bash_exec "ROOT=$root"
+set files [split [exec bash -c "cd $dir && ls"] "\n"]
+assert_complete $files "removepkg " $test
sync_after_int
diff --git a/test/lib/completions/reptyr.exp b/test/lib/completions/reptyr.exp
new file mode 100644
index 00000000..35ccb91c
--- /dev/null
+++ b/test/lib/completions/reptyr.exp
@@ -0,0 +1,22 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "reptyr -"
+sync_after_int
+
+
+assert_complete_any "reptyr "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rfcomm.exp b/test/lib/completions/rfcomm.exp
new file mode 100644
index 00000000..b449134c
--- /dev/null
+++ b/test/lib/completions/rfcomm.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "rfcomm "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ri.exp b/test/lib/completions/ri.exp
index cd138ea0..e6661d1b 100644
--- a/test/lib/completions/ri.exp
+++ b/test/lib/completions/ri.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "ri "
+assert_complete_any "ri RI"
sync_after_int
diff --git a/test/lib/completions/route.exp b/test/lib/completions/route.exp
new file mode 100644
index 00000000..76e1b5e0
--- /dev/null
+++ b/test/lib/completions/route.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "route "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rpm2tgz.exp b/test/lib/completions/rpm2tgz.exp
new file mode 100644
index 00000000..eb597982
--- /dev/null
+++ b/test/lib/completions/rpm2tgz.exp
@@ -0,0 +1,31 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}
+
+
+setup
+
+
+assert_complete_any "rpm2tgz -"
+
+
+sync_after_int
+
+
+set test "should complete *.rpm files and dirs"
+set dir $::srcdir/fixtures/slackware/home
+set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \
+ \\( -type d -printf '%P/\\n' \\) -o \
+ \\( -type f -name '*.rpm' -printf '%P\\n' \\)"] "\n"]
+assert_complete_dir $files "rpm2tgz " $dir $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rpmbuild.exp b/test/lib/completions/rpmbuild.exp
new file mode 100644
index 00000000..4058d722
--- /dev/null
+++ b/test/lib/completions/rpmbuild.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "rpmbuild -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/rsync.exp b/test/lib/completions/rsync.exp
index 221d090b..42b7af8e 100644
--- a/test/lib/completions/rsync.exp
+++ b/test/lib/completions/rsync.exp
@@ -12,8 +12,14 @@ setup
assert_complete_any "rsync "
+sync_after_int
+
+
+assert_complete "rsh ssh" "rsync --rsh "
+sync_after_int
+assert_complete "rsh ssh" "rsync --rsh="
sync_after_int
diff --git a/test/lib/completions/sbopkg.exp b/test/lib/completions/sbopkg.exp
new file mode 100644
index 00000000..c4dbfe26
--- /dev/null
+++ b/test/lib/completions/sbopkg.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "sbopkg -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/scp.exp b/test/lib/completions/scp.exp
index e6cbf8e3..7cc6eb07 100644
--- a/test/lib/completions/scp.exp
+++ b/test/lib/completions/scp.exp
@@ -24,7 +24,7 @@ set host bash_completion
# Retrieving home directory (host_pwd) from ssh-host `bash_completion'
# yields error?
-if {
+if {
[catch {
exec -- ssh -o "Batchmode yes" -o "ConnectTimeout 1" $host pwd 2>> /dev/null
} host_pwd]
@@ -64,7 +64,7 @@ foreach host [get_hosts] {
lappend expected blah: doo: gee: hus: ike:
# Append local filenames
lappend expected config known_hosts "spaced\\ \\ conf"
-assert_complete $expected "scp -F config "
+assert_complete $expected "scp -F config " $test
sync_after_int
@@ -104,11 +104,8 @@ if {[match_items [lsort -unique $expected] -bash-sort]} {
expect {
-re /@ { pass "$test" }
-re eof { unresolved "eof" }
+ default { fail "$test" }
}
-} else {
- # Expected failure (known bug) because of bash-4 bug in quoted words:
- # http://www.mail-archive.com/bug-bash@gnu.org/msg06095.html
- if {[lindex $::BASH_VERSINFO 0] >= 4} {xfail "$test"} {fail "$test"}
}
sync_after_int
assert_bash_exec {cd "$TESTDIR"}
diff --git a/test/lib/completions/screen.exp b/test/lib/completions/screen.exp
index e5bc4c15..5e585179 100644
--- a/test/lib/completions/screen.exp
+++ b/test/lib/completions/screen.exp
@@ -12,15 +12,19 @@ setup
assert_complete_any "screen -"
-
-
sync_after_int
assert_complete {bar "bar bar.d/" foo foo.d/} \
"screen -c $::srcdir/fixtures/shared/default/" "-c should complete files/dirs"
+sync_after_int
+
+
+assert_complete_any "screen cat"
+sync_after_int
+assert_complete_any "screen -T foo cat"
sync_after_int
diff --git a/test/lib/completions/sdptool.exp b/test/lib/completions/sdptool.exp
new file mode 100644
index 00000000..c46a1fa2
--- /dev/null
+++ b/test/lib/completions/sdptool.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "sdptool "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/setquota.exp b/test/lib/completions/setquota.exp
new file mode 100644
index 00000000..d169e1ad
--- /dev/null
+++ b/test/lib/completions/setquota.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "setquota "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/slackpkg.exp b/test/lib/completions/slackpkg.exp
new file mode 100644
index 00000000..150f03fc
--- /dev/null
+++ b/test/lib/completions/slackpkg.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "slackpkg -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/slapt-get.exp b/test/lib/completions/slapt-get.exp
new file mode 100644
index 00000000..70afc666
--- /dev/null
+++ b/test/lib/completions/slapt-get.exp
@@ -0,0 +1,46 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "slapt-get -"
+
+
+sync_after_int
+
+
+set test "--up<TAB> should complete \"--update --upgrade\""
+assert_complete "--update --upgrade" "slapt-get --up" $test
+
+
+sync_after_int
+
+
+
+set test "--install should complete available packages"
+set config $::srcdir/fixtures/slackware/etc/slapt-get/slapt-getrc
+set workdir [file normalize $::srcdir/fixtures/slackware/var/slapt-get/]
+set pkg_data "$workdir/package_data"
+# write simple config
+set f [open $config w]
+puts $f "WORKINGDIR=$workdir"
+puts $f "SOURCE=file:///home/"
+close $f
+set packages [split [exec bash -c "sed -n \
+ '/^PACKAGE NAME:/{s/^PACKAGE NAME: \\{1,\\}\\(.*\\).t\[gbxl\]z/\\1/;p}' \
+ $pkg_data"] "\n"]
+assert_complete $packages "slapt-get -c $config --install " $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/slapt-src.exp b/test/lib/completions/slapt-src.exp
new file mode 100644
index 00000000..9410f9c1
--- /dev/null
+++ b/test/lib/completions/slapt-src.exp
@@ -0,0 +1,49 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "slapt-src -"
+
+
+sync_after_int
+
+
+set test "--bu<TAB> should complete \"--build\""
+assert_complete "--build" "slapt-src --bu" $test
+
+
+sync_after_int
+
+
+set test "--ins<TAB> should complete \"--install\""
+assert_complete "--install" "slapt-src --ins" $test
+
+
+sync_after_int
+
+
+set test "--install should complete available packages"
+set config $::srcdir/fixtures/slackware/etc/slapt-get/slapt-srcrc
+set workdir [file normalize $::srcdir/fixtures/slackware/usr/src/slapt-src/]
+set slb_data "$workdir/slackbuilds_data"
+set f [open $config w]; puts $f "BUILDDIR=$workdir"; close $f
+set slackbuilds [split [exec bash -c "sed -n \
+ -e '/^SLACKBUILD NAME: /{s/^SLACKBUILD NAME: \\{1,\\}//;p}' \
+ -e '/^SLACKBUILD VERSION: /{s/^SLACKBUILD VERSION: \\{1,\\}//;p}' \
+ $slb_data | sed -e 'N;s/\\n/:/'"] "\n"]
+assert_complete $slackbuilds "slapt-src --config $config --install " $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/smbcacls.exp b/test/lib/completions/smbcacls.exp
new file mode 100644
index 00000000..d501f825
--- /dev/null
+++ b/test/lib/completions/smbcacls.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "smbcacls -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/smbclient.exp b/test/lib/completions/smbclient.exp
new file mode 100644
index 00000000..0fb8e2da
--- /dev/null
+++ b/test/lib/completions/smbclient.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "smbclient -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/smbcquotas.exp b/test/lib/completions/smbcquotas.exp
new file mode 100644
index 00000000..24be2f60
--- /dev/null
+++ b/test/lib/completions/smbcquotas.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "smbcquotas -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/smbget.exp b/test/lib/completions/smbget.exp
new file mode 100644
index 00000000..938cd0e5
--- /dev/null
+++ b/test/lib/completions/smbget.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "smbget -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/smbpasswd.exp b/test/lib/completions/smbpasswd.exp
new file mode 100644
index 00000000..b6e86bbc
--- /dev/null
+++ b/test/lib/completions/smbpasswd.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "smbpasswd -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/smbtar.exp b/test/lib/completions/smbtar.exp
new file mode 100644
index 00000000..e0d58f5f
--- /dev/null
+++ b/test/lib/completions/smbtar.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "smbtar -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/smbtree.exp b/test/lib/completions/smbtree.exp
new file mode 100644
index 00000000..b234e443
--- /dev/null
+++ b/test/lib/completions/smbtree.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "smbtree -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ssh-copy-id.exp b/test/lib/completions/ssh-copy-id.exp
new file mode 100644
index 00000000..e8b643fd
--- /dev/null
+++ b/test/lib/completions/ssh-copy-id.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ssh-copy-id -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/stream.exp b/test/lib/completions/stream.exp
new file mode 100644
index 00000000..8cbda602
--- /dev/null
+++ b/test/lib/completions/stream.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "stream "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/sudo.exp b/test/lib/completions/sudo.exp
index d6bbbbb6..6108ddce 100644
--- a/test/lib/completions/sudo.exp
+++ b/test/lib/completions/sudo.exp
@@ -24,4 +24,63 @@ assert_complete_dir fixtures/ "sudo sh fix" $::srcdir "" -nospace
sync_after_int
+# test that `mount` and `sudo mount` behave the same way
+set test "sudo mount /dev/sda1 def should complete directory name"
+assert_complete_dir "default/" "sudo mount /dev/sda1 def" $::srcdir/fixtures/shared $test -nospace
+
+
+sync_after_int
+
+
+# Find user/group suitable for testing.
+set failed_find_unique_completion 0
+foreach ug {user group} {
+ # compgen -A is used because it's a bash builtin and available everywhere.
+ # The || true part prevents exec from throwing an exception if nothing is
+ # found (very very unlikely).
+ set list [split [exec bash -c "compgen -A $ug || true"] "\n"]
+ if {![find_unique_completion_pair $list part$ug full$ug]} {
+ untested "Not running complex chown tests; no suitable test $ug found."
+ set failed_find_unique_completion 1
+ }
+}
+
+# These tests require an unique completion.
+if {!$failed_find_unique_completion} {
+ assert_complete $fulluser "sudo chown $partuser"
+ sync_after_int
+
+ assert_complete $fulluser:$fullgroup "sudo chown $fulluser:$partgroup"
+ sync_after_int
+
+ assert_complete "dot.user:$fullgroup" "sudo chown dot.user:$partgroup"
+ sync_after_int
+
+ foreach prefix {
+ "funky\\ user:" "funky.user:" "funky\\.user:" "fu\\ nky.user:"
+ "f\\ o\\ o\\.\\bar:" "foo\\_b\\ a\\.r\\ :"
+ } {
+ set test "Check preserve special chars in $prefix$partgroup<TAB>"
+ #assert_complete_into "chown $prefix$partgroup" "chown $prefix$fullgroup " $test
+ assert_complete $prefix$fullgroup "sudo chown $prefix$partgroup" $test
+ sync_after_int
+ }
+
+ # Check that we give up in degenerate cases instead of spewing various junk.
+
+ assert_no_complete "sudo chown $fulluser\\\\:$partgroup"
+ sync_after_int
+
+ assert_no_complete "sudo chown $fulluser\\\\\\:$partgroup"
+ sync_after_int
+
+ assert_no_complete "sudo chown $fulluser\\\\\\\\:$partgroup"
+ sync_after_int
+
+ # Colons in user/groupnames are not usually allowed.
+ assert_no_complete "sudo chown foo:bar:$partgroup"
+ sync_after_int
+}
+
+
teardown
diff --git a/test/lib/completions/tcpdump.exp b/test/lib/completions/tcpdump.exp
new file mode 100644
index 00000000..79158abf
--- /dev/null
+++ b/test/lib/completions/tcpdump.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "tcpdump -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/time.exp b/test/lib/completions/time.exp
index 3bed4fdf..d052458c 100644
--- a/test/lib/completions/time.exp
+++ b/test/lib/completions/time.exp
@@ -4,7 +4,7 @@ proc setup {} {
proc teardown {} {
- assert_env_unmodified
+ assert_env_unmodified {/OLDPWD=/d}
}
@@ -17,4 +17,20 @@ assert_complete_any "time set"
sync_after_int
+set test "-p find -typ should complete find's options"
+assert_complete "-type" "time -p find -typ" $test
+
+
+sync_after_int
+
+
+set test "it should be possible to complete file paths"
+set dir $::srcdir/fixtures/shared
+set files [split [exec bash -c "cd $dir/bin && ls -p"] "\n"]
+assert_complete_dir $files "time ./bin/" $dir $test
+
+
+sync_after_int
+
+
teardown
diff --git a/test/lib/completions/tracepath.exp b/test/lib/completions/tracepath.exp
new file mode 100644
index 00000000..33b32567
--- /dev/null
+++ b/test/lib/completions/tracepath.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "tracepath "
+sync_after_int
+
+assert_complete_any "tracepath -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/upgradepkg.exp b/test/lib/completions/upgradepkg.exp
new file mode 100644
index 00000000..860dde9e
--- /dev/null
+++ b/test/lib/completions/upgradepkg.exp
@@ -0,0 +1,39 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}
+
+
+setup
+
+
+assert_complete_any "upgradepkg -"
+
+
+sync_after_int
+
+
+set test "--<TAB> should complete all long options"
+set options [list --dry-run --install-new --reinstall --verbose]
+assert_complete $options "upgradepkg --" $test
+
+
+sync_after_int
+
+
+set test "should complete *.t\[gbxl\]z files and dirs"
+set dir $::srcdir/fixtures/slackware/home
+set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \
+ \\( -type d -printf '%P/\\n' \\) -o \
+ \\( -type f -name '*.t\[bglx\]z' -printf '%P\\n' \\)"] "\n"]
+assert_complete_dir $files "upgradepkg " $dir $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/vgcfgbackup.exp b/test/lib/completions/vgcfgbackup.exp
index b7e509a2..14162ee0 100644
--- a/test/lib/completions/vgcfgbackup.exp
+++ b/test/lib/completions/vgcfgbackup.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgcfgbackup -"
+if {[assert_exec {vgcfgbackup --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgcfgbackup -"
+}
sync_after_int
diff --git a/test/lib/completions/vgcfgrestore.exp b/test/lib/completions/vgcfgrestore.exp
index e40cd213..2cf5f1ca 100644
--- a/test/lib/completions/vgcfgrestore.exp
+++ b/test/lib/completions/vgcfgrestore.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgcfgrestore -"
+if {[assert_exec {vgcfgrestore --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgcfgrestore -"
+}
sync_after_int
diff --git a/test/lib/completions/vgck.exp b/test/lib/completions/vgck.exp
index b4d58aec..b2c86da8 100644
--- a/test/lib/completions/vgck.exp
+++ b/test/lib/completions/vgck.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgck -"
+if {[assert_exec {vgck --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgck -"
+}
sync_after_int
diff --git a/test/lib/completions/vgconvert.exp b/test/lib/completions/vgconvert.exp
index 362c44b6..f432229e 100644
--- a/test/lib/completions/vgconvert.exp
+++ b/test/lib/completions/vgconvert.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgconvert -"
+if {[assert_exec {vgconvert --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgconvert -"
+}
sync_after_int
diff --git a/test/lib/completions/vgdisplay.exp b/test/lib/completions/vgdisplay.exp
index 6a8ed84d..5fd20596 100644
--- a/test/lib/completions/vgdisplay.exp
+++ b/test/lib/completions/vgdisplay.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgdisplay -"
+if {[assert_exec {vgdisplay --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgdisplay -"
+}
sync_after_int
diff --git a/test/lib/completions/vgexport.exp b/test/lib/completions/vgexport.exp
index 2900960f..e6e45d00 100644
--- a/test/lib/completions/vgexport.exp
+++ b/test/lib/completions/vgexport.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgexport -"
+if {[assert_exec {vgexport --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgexport -"
+}
sync_after_int
diff --git a/test/lib/completions/vgextend.exp b/test/lib/completions/vgextend.exp
index 3c46a8f0..18dc2016 100644
--- a/test/lib/completions/vgextend.exp
+++ b/test/lib/completions/vgextend.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgextend -"
+if {[assert_exec {vgextend --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgextend -"
+}
sync_after_int
diff --git a/test/lib/completions/vgimport.exp b/test/lib/completions/vgimport.exp
index ed04e282..f4c1f833 100644
--- a/test/lib/completions/vgimport.exp
+++ b/test/lib/completions/vgimport.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgimport -"
+if {[assert_exec {vgimport --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgimport -"
+}
sync_after_int
diff --git a/test/lib/completions/vgmerge.exp b/test/lib/completions/vgmerge.exp
index a4f8833b..a8366848 100644
--- a/test/lib/completions/vgmerge.exp
+++ b/test/lib/completions/vgmerge.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgmerge -"
+if {[assert_exec {vgmerge --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgmerge -"
+}
sync_after_int
diff --git a/test/lib/completions/vgmknodes.exp b/test/lib/completions/vgmknodes.exp
index 5c9feeb3..b8c3d57f 100644
--- a/test/lib/completions/vgmknodes.exp
+++ b/test/lib/completions/vgmknodes.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgmknodes -"
+if {[assert_exec {vgmknodes --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgmknodes -"
+}
sync_after_int
diff --git a/test/lib/completions/vgreduce.exp b/test/lib/completions/vgreduce.exp
index f6af3150..fc349680 100644
--- a/test/lib/completions/vgreduce.exp
+++ b/test/lib/completions/vgreduce.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgreduce -"
+if {[assert_exec {vgreduce --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgreduce -"
+}
sync_after_int
diff --git a/test/lib/completions/vgremove.exp b/test/lib/completions/vgremove.exp
index 0dc5eda8..0ec1011f 100644
--- a/test/lib/completions/vgremove.exp
+++ b/test/lib/completions/vgremove.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgremove -"
+if {[assert_exec {vgremove --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgremove -"
+}
sync_after_int
diff --git a/test/lib/completions/vgrename.exp b/test/lib/completions/vgrename.exp
index 81438631..62e7d3e6 100644
--- a/test/lib/completions/vgrename.exp
+++ b/test/lib/completions/vgrename.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgrename -"
+if {[assert_exec {vgrename --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgrename -"
+}
sync_after_int
diff --git a/test/lib/completions/vgs.exp b/test/lib/completions/vgs.exp
index 22ab176b..8a6cf650 100644
--- a/test/lib/completions/vgs.exp
+++ b/test/lib/completions/vgs.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgs -"
+if {[assert_exec {vgs --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgs -"
+}
sync_after_int
diff --git a/test/lib/completions/vgscan.exp b/test/lib/completions/vgscan.exp
index ae8168c8..a26838fc 100644
--- a/test/lib/completions/vgscan.exp
+++ b/test/lib/completions/vgscan.exp
@@ -11,7 +11,9 @@ proc teardown {} {
setup
-assert_complete_any "vgscan -"
+if {[assert_exec {vgscan --help} "" "" "untested"]} { # may fail as non-root
+ assert_complete_any "vgscan -"
+}
sync_after_int
diff --git a/test/lib/completions/vipw.exp b/test/lib/completions/vipw.exp
new file mode 100644
index 00000000..c29ad9b1
--- /dev/null
+++ b/test/lib/completions/vipw.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "vipw -"
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/watch.exp b/test/lib/completions/watch.exp
new file mode 100644
index 00000000..02ae8f1b
--- /dev/null
+++ b/test/lib/completions/watch.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "watch -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/xgamma.exp b/test/lib/completions/xgamma.exp
new file mode 100644
index 00000000..c4c2228e
--- /dev/null
+++ b/test/lib/completions/xgamma.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+set test "-gam<TAB> should complete \"-gamma\""
+assert_complete "-gamma" "xgamma -gam" $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/xhost.exp b/test/lib/completions/xhost.exp
index 82e2e9c6..02aa4cb2 100644
--- a/test/lib/completions/xhost.exp
+++ b/test/lib/completions/xhost.exp
@@ -30,7 +30,7 @@ foreach h [get_hosts] {
lappend hosts $h
}
}
-assert_complete $hosts "xhost $char" $test
+assert_complete $hosts "xhost $char" $test -expect-cmd-minus "$char"
sync_after_int
@@ -58,7 +58,7 @@ foreach h [get_hosts] {
lappend hosts "+$h"
}
}
-assert_complete $hosts "xhost +$char"
+assert_complete $hosts "xhost +$char" $test -expect-cmd-minus "\+$char"
sync_after_int
@@ -86,7 +86,7 @@ foreach h [get_hosts] {
lappend hosts "-$h"
}
}
-assert_complete $hosts "xhost -$char" $test
+assert_complete $hosts "xhost -$char" $test -expect-cmd-minus "-$char"
sync_after_int
diff --git a/test/lib/completions/xvnc4viewer.exp b/test/lib/completions/xvnc4viewer.exp
index b10e272c..6432ed25 100644
--- a/test/lib/completions/xvnc4viewer.exp
+++ b/test/lib/completions/xvnc4viewer.exp
@@ -22,7 +22,7 @@ set options {
-via -ViewOnly -WMDecorationHeight -WMDecorationWidth
-ZlibLevel
}
-assert_complete $options {vncviewer -}
+assert_complete $options {vncviewer -} $test
sync_after_int
diff --git a/test/lib/completions/xzdec.exp b/test/lib/completions/xzdec.exp
new file mode 100644
index 00000000..578cba7d
--- /dev/null
+++ b/test/lib/completions/xzdec.exp
@@ -0,0 +1,20 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "xzdec "
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/lib/library.exp b/test/lib/library.exp
index 491da212..f6e9f21a 100644
--- a/test/lib/library.exp
+++ b/test/lib/library.exp
@@ -155,8 +155,6 @@ proc assert_bash_list_dir {expected cmd dir test {args {}}} {
# - the last whitespace is escaped, e.g. "finger foo\ " or "finger
# 'foo "
#
-# If the entire $cmd is expected, specify `-expect-cmd-full'.
-#
# @param list $expected Expected completions.
# @param string $cmd Command given to generate items
# @param string $test Test title
@@ -168,12 +166,6 @@ proc assert_bash_list_dir {expected cmd dir test {args {}}} {
# Valid only if a single completion is expected.
# -ltrim-colon-completions Left-trim completions with cword containing
# colon (:)
-# -expect-cmd-full Expect the full $cmd to be echoed. Expected is:
-#
-# $cmd<TAB>\n
-# $expected\n
-# $prompt + $cmd + longest-common-prefix-of-$expected
-#
# -expect-cmd-minus DWORD Expect $cmd minus DWORD to be echoed.
# Expected is:
#
@@ -188,7 +180,6 @@ proc assert_complete {expected cmd {test ""} {args {}}} {
{chunk-size.arg 20 "compare N list items at a time"}
{nospace "don't expect space after completion"}
{ltrim-colon-completions "left-trim completions with cword containing :"}
- {expect-cmd-full "Expect full cmd after prompt"}
{expect-cmd-minus.arg "" "Expect cmd minus DWORD after prompt"}
}]
if {[llength $expected] == 0} {
@@ -210,7 +201,6 @@ proc assert_complete_many {expected cmd {test ""} {args {}}} {
{chunk-size.arg 20 "compare N list items at a time"}
{nospace "don't expect space after completion"}
{ltrim-colon-completions "left-trim completions with cword containing :"}
- {expect-cmd-full "Expect full cmd after prompt"}
{expect-cmd-minus.arg "" "Expect cmd minus CWORD after prompt"}
}]
if {$test == ""} {set test "$cmd should show completions"}
@@ -256,7 +246,6 @@ proc assert_complete_one {expected cmd {test ""} {args {}}} {
{chunk-size.arg 20 "compare N list items at a time"}
{nospace "don't expect space after completion"}
{ltrim-colon-completions "left-trim completions with cword containing :"}
- {expect-cmd-full "Expect full cmd after prompt"}
{expect-cmd-minus.arg "" "Expect cmd minus CWORD after prompt"}
}]
set prompt $arg(prompt)
@@ -435,13 +424,9 @@ proc _ltrim_colon_completions {cmd items dword} {
set cur [lindex $words $index]
}
# If word-to-complete contains a colon,
- # and bash-version < 4,
- # or bash-version >= 4 and COMP_WORDBREAKS contains a colon
+ # and COMP_WORDBREAKS contains a colon
if {
- [string first : $cur] > -1 && (
- [lindex $::BASH_VERSINFO 0] < 4 ||
- ([lindex $::BASH_VERSINFO 0] >= 4 && [string first ":" $::COMP_WORDBREAKS] > -1)
- )
+ [string first : $cur] > -1 && [string first ":" $::COMP_WORDBREAKS] > -1
} {
set dword_out $cur
for {set i 0} {$i < [llength $items_out]} {incr i} {
@@ -595,12 +580,13 @@ proc assert_no_output {{cmd} {test ""} {prompt /@}} {
# Source/run file with additional tests if completion for the specified command
-# is installed in bash.
+# is installed in bash, and the command is available.
# @param string $command Command to check completion availability for.
# @param string $file (optional) File to source/run. Default is
# "lib/completions/$cmd.exp".
proc assert_source_completions {command {file ""}} {
- if {[is_bash_completion_installed_for $command]} {
+ if {[assert_bash_type $command]
+ && [is_bash_completion_installed_for $command]} {
if {[string length $file] == 0} {
set file "$::srcdir/lib/completions/$command.exp"
}
@@ -633,10 +619,17 @@ proc get_known_hosts {{cword ''}} {
# Get hostnames
+# @param list $args Options:
+# -unsorted Do not sort unique. Default is sort unique.
# @return list Hostnames
# @see get_known_hosts()
-proc get_hosts {} {
- set hosts [exec bash -c "compgen -A hostname | sort -u"]
+proc get_hosts {{args {}}} {
+ array set arg [::cmdline::getoptions args {
+ {unsorted "do not sort unique"}
+ }]
+ set sort "| sort -u"
+ if {$arg(unsorted)} {set sort ""}
+ set hosts [exec bash -c "compgen -A hostname $sort"]
# NOTE: Circumventing var `avahi_hosts' and appending directly to `hosts'
# causes an empty element to be inserted in `hosts'.
# -- FVu, Fri Jul 17 23:11:46 CEST 2009
@@ -667,8 +660,9 @@ proc get_hosts_avahi {} {
# Get signals
# This function is written in analogy to the bash function `_signals()' in
# `bash_completion'.
+# @param prefix
# @return list Signals starting with `SIG', but with the `SIG' prefix removed.
-proc get_signals {} {
+proc get_signals {{prefix ""}} {
set signals {}
foreach signal [exec bash -c {compgen -A signal}] {
# Does signal start with `SIG'?
@@ -676,7 +670,7 @@ proc get_signals {} {
# Remove `SIG' prefix
set signal [string range $signal 3 end]
# Add signal (with dash (-) prefix) to list
- lappend signals -$signal
+ lappend signals $prefix$signal
}
}
return $signals
@@ -855,10 +849,8 @@ proc _save_env {{file ""}} {
# Source bash_completion package
proc source_bash_completion {} {
- assert_bash_exec {BASH_COMPLETION_DIR=$(cd "$SRCDIR/.."; pwd)/completions}
- assert_bash_exec {BASH_COMPLETION_COMPAT_DIR=$BASH_COMPLETION_DIR}
- assert_bash_exec {BASH_COMPLETION=$(cd "$SRCDIR/.."; pwd)/bash_completion}
- assert_bash_exec {source "$BASH_COMPLETION"}
+ assert_bash_exec {BASH_COMPLETION_COMPAT_DIR=$(cd "$SRCDIR/.."; pwd)/completions}
+ assert_bash_exec {source $(cd "$SRCDIR/.."; pwd)/bash_completion}
}
@@ -980,29 +972,17 @@ proc start_bash {} {
set env(SRCDIRABS) $::srcdirabs
exp_spawn $TOOL_EXECUTABLE --rcfile $::srcdir/config/bashrc
assert_bash_exec {} "$TOOL_EXECUTABLE --rcfile $::srcdir/config/bashrc"
- # Bash < 3.2.41 has a bug where 'history' disappears from SHELLOPTS
- # whenever a shopt setting is sourced or eval'ed. Disabling 'history'
- # makes it not show in tests "Environment should not be modified"
- # for bash < 3.2.41.
- # -- FVu, Tue Sep 15 22:52:00 CEST 2009
- assert_bash_exec {is_bash_version_minimal 3 2 41 || set +o history}
}
# Redirect xtrace output to a file.
#
# 'set -x' can be very useful for debugging but by default it writes to
-# stderr. Bash 4.1 has a feature to redirect this output to a random FD.
+# stderr.
#
# This function uses file descriptor 6. This will break if any completion
# tries to use the same descriptor.
proc init_bash_xtrace {{fname xtrace.log}} {
- global BASH_VERSINFO
- if {([lindex $BASH_VERSINFO 0] == 4 && [lindex $BASH_VERSINFO 1] < 1) ||
- [lindex $BASH_VERSINFO 0] < 4} {
- note "BASH_XTRACEFD not available in this version; no xtrace.log"
- return
- }
verbose "Enabling bash xtrace output to '$fname'"
assert_bash_exec "exec 6>'$fname'"
assert_bash_exec "BASH_XTRACEFD=6"
diff --git a/test/lib/library.sh b/test/lib/library.sh
index 98107dcb..290ec813 100644
--- a/test/lib/library.sh
+++ b/test/lib/library.sh
@@ -4,9 +4,7 @@
# @param $1 Char to add to $COMP_WORDBREAKS
# @see remove_comp_wordbreak_char()
add_comp_wordbreak_char() {
- if [ ${BASH_VERSINFO[0]} -ge 4 ]; then
- [[ "${COMP_WORDBREAKS//[^$1]}" ]] || COMP_WORDBREAKS=$COMP_WORDBREAKS$1
- fi
+ [[ "${COMP_WORDBREAKS//[^$1]}" ]] || COMP_WORDBREAKS+=$1
} # add_comp_wordbreak_char()
@@ -24,6 +22,8 @@ diff_env() {
/[<>] _=/d
# Remove PPID bash variable
/[<>] PPID=/d
+# Remove BASH_REMATCH bash variable
+ /[<>] BASH_REMATCH=/d
$3"
} # diff_env()
@@ -60,9 +60,7 @@ is_bash_version_minimal() {
# @param $1 Char to remove from $COMP_WORDBREAKS
# @see add_comp_wordbreak_char()
remove_comp_wordbreak_char() {
- if [ ${BASH_VERSINFO[0]} -ge 4 ]; then
- COMP_WORDBREAKS=${COMP_WORDBREAKS//$1}
- fi
+ COMP_WORDBREAKS=${COMP_WORDBREAKS//$1}
} # remove_comp_wordbreak_char()
diff --git a/test/unit/_filedir.exp b/test/unit/_filedir.exp
index de494084..0bba8314 100644
--- a/test/unit/_filedir.exp
+++ b/test/unit/_filedir.exp
@@ -124,120 +124,108 @@ foreach name {f f2} {
sync_after_int
- # NOTE: Bash versions 4.0.0 up to 4.0.34 contain a bug when completing quoted
- # words, so tests below aren't executed for these bash versions.
- if {! (
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
- )} {
- set cmd "$name 'ab/"
- assert_complete_dir {e'} $cmd "$::srcdir/fixtures/_filedir"
+ set cmd "$name 'ab/"
+ assert_complete_dir {e'} $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
+ sync_after_int
- set cmd "$name 'a b/"
- assert_complete_dir {i'} $cmd "$::srcdir/fixtures/_filedir"
+ set cmd "$name 'a b/"
+ assert_complete_dir {i'} $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
+ sync_after_int
- set cmd "$name 'a\"b/"; #"
- assert_complete_dir {d'} $cmd "$::srcdir/fixtures/_filedir"
+ set cmd "$name 'a\"b/"; #"
+ assert_complete_dir {d'} $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
+ sync_after_int
- set cmd "$name 'a\$b/"
- if {[lindex $::BASH_VERSINFO 0] == 4} {
- assert_complete_dir {h'} $cmd "$::srcdir/fixtures/_filedir"
- } else {
- assert_complete_dir "\b\b\b\b$::srcdirabs/fixtures/_filedir/a\$b/h'" $cmd "$::srcdir/fixtures/_filedir"
- }
+ set cmd "$name 'a\$b/"
+ assert_complete_dir {h'} $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
+ sync_after_int
- # Execute these tests only when not running on Cygwin/Windows, because
- # directories containing `*' or `\' aren't allowed on Cygwin/Windows
- if {! [is_cygwin]} {
- set cmd "$name '$TESTDIR/tmp/a\\b/"
- assert_complete_dir {g'} $cmd "$TESTDIR/tmp"
+ # Execute these tests only when not running on Cygwin/Windows, because
+ # directories containing `*' or `\' aren't allowed on Cygwin/Windows
+ if {! [is_cygwin]} {
+ set cmd "$name '$TESTDIR/tmp/a\\b/"
+ assert_complete_dir {g'} $cmd "$TESTDIR/tmp"
- sync_after_int
- }
+ sync_after_int
+ }
- set cmd "$name 'a&b/"
- assert_complete_dir {f'} $cmd "$::srcdir/fixtures/_filedir"
+ set cmd "$name 'a&b/"
+ assert_complete_dir {f'} $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
+ sync_after_int
- set cmd "$name \"ab/"; #"
- assert_complete_dir {e"} $cmd "$::srcdir/fixtures/_filedir"; #"
+ set cmd "$name \"ab/"; #"
+ assert_complete_dir {e"} $cmd "$::srcdir/fixtures/_filedir"; #"
- sync_after_int
+ sync_after_int
- set cmd "$name \"a b/"; #"
- assert_complete_dir {i"} $cmd "$::srcdir/fixtures/_filedir"; #"
+ set cmd "$name \"a b/"; #"
+ assert_complete_dir {i"} $cmd "$::srcdir/fixtures/_filedir"; #"
- sync_after_int
+ sync_after_int
- set cmd "$name \"a'b/"; #"
- assert_complete_dir {c"} $cmd "$::srcdir/fixtures/_filedir"; #"
+ set cmd "$name \"a'b/"; #"
+ assert_complete_dir {c"} $cmd "$::srcdir/fixtures/_filedir"; #"
- sync_after_int
+ sync_after_int
- set cmd "$name \"a\\\"b/"; #"
- assert_complete_dir {d"} $cmd "$::srcdir/fixtures/_filedir"; #"
+ set cmd "$name \"a\\\"b/"; #"
+ assert_complete_dir {d"} $cmd "$::srcdir/fixtures/_filedir"; #"
- sync_after_int
+ sync_after_int
- set cmd "$name \"a\\\$b/"; #"
- assert_complete_dir "\b\b\b\b\b$::srcdirabs/fixtures/_filedir/a\\\\\$b/h\\\"" $cmd "$::srcdir/fixtures/_filedir"
+ set cmd "$name \"a\\\$b/"; #"
+ assert_complete_dir "\b\b\b\b\b$::srcdirabs/fixtures/_filedir/a\\\\\$b/h\\\"" $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
+ sync_after_int
- set cmd "$name \"a\\b/"; #"
- assert_complete_dir "\b\b\bb/e\\\"" $cmd "$::srcdir/fixtures/_filedir"
+ set cmd "$name \"a\\b/"; #"
+ assert_complete_dir "\b\b\bb/e\\\"" $cmd "$::srcdir/fixtures/_filedir"
- sync_after_int
+ sync_after_int
- set cmd "$name \"a\\\\b/"; #"
- assert_complete_dir {g"} $cmd "$TESTDIR/tmp"; #"
+ set cmd "$name \"a\\\\b/"; #"
+ assert_complete_dir {g"} $cmd "$TESTDIR/tmp"; #"
- sync_after_int
+ sync_after_int
- set cmd "$name \"a&b/"; #"
- assert_complete_dir {f"} $cmd "$::srcdir/fixtures/_filedir"; #"
+ set cmd "$name \"a&b/"; #"
+ assert_complete_dir {f"} $cmd "$::srcdir/fixtures/_filedir"; #"
- sync_after_int
+ sync_after_int
- }; # if 4.0.0 < bash-version > 4.0.34
}; # foreach
@@ -249,13 +237,12 @@ sync_after_int
set test "completing f aƩ should return g"
-# Execute this test only on bash >= 4 with LC_CTYPE matching *UTF-8*
+# Execute this test only with LC_CTYPE matching *UTF-8*
# See also: http://www.mail-archive.com/bash-completion-devel\
# @lists.alioth.debian.org/msg02265.html
# Don't execute this test on expect-5.44 cause it will segfault
# See also: Alioth #312792
if {
- [lindex $::BASH_VERSINFO 0] >= 4 &&
[string first "UTF-8" $::LC_CTYPE] != -1 &&
[string first 5.44 [exp_version]] != 0
} {
diff --git a/test/unit/_get_comp_words_by_ref.exp b/test/unit/_get_comp_words_by_ref.exp
index 2ddcef23..f5c7ab38 100644
--- a/test/unit/_get_comp_words_by_ref.exp
+++ b/test/unit/_get_comp_words_by_ref.exp
@@ -48,6 +48,33 @@ assert_bash_list {" a"} $cmd $test
sync_after_int
+set test "|a"; # | = cursor position
+set cmd {COMP_WORDS=(a); COMP_CWORD=0; COMP_LINE='a'; COMP_POINT=0; \
+ unset cur prev; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
+assert_bash_list {" "} $cmd $test
+
+
+sync_after_int
+
+
+set test "|a \$"; # | = cursor position
+set cmd {COMP_WORDS=(a); COMP_CWORD=0; COMP_LINE='a '; COMP_POINT=0; \
+ unset cur prev; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
+assert_bash_list {" "} $cmd $test
+
+
+sync_after_int
+
+
+set test " | a \$"; # | = cursor position
+set cmd {COMP_WORDS=(a); COMP_CWORD=0; COMP_LINE=' a '; COMP_POINT=1; \
+ unset cur prev; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
+assert_bash_list {" "} $cmd $test
+
+
+sync_after_int
+
+
set test "a b |"; # | = cursor position
set cmd {COMP_WORDS=(a b ''); COMP_CWORD=2; COMP_LINE='a b '; COMP_POINT=4; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
assert_bash_list {" b"} $cmd $test
@@ -72,6 +99,14 @@ assert_bash_list {"b a"} $cmd $test
sync_after_int
+set test "a | b"; # | = cursor position
+set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=2; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
+assert_bash_list {" a"} $cmd $test
+
+
+sync_after_int
+
+
set test {a b\ c| should return b\ c}; # | = cursor position
set cmd {COMP_WORDS=(a 'b\ c'); COMP_CWORD=1; COMP_LINE='a b\ c'; COMP_POINT=6; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
assert_bash_list {"b\\ c a"} $cmd $test
@@ -97,27 +132,13 @@ sync_after_int
set test {a 'b c|}; # | = cursor position
-if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
-} {
- set cmd {COMP_WORDS=(a "'" b c); COMP_CWORD=3}
-} else {
- set cmd {COMP_WORDS=(a "'b c"); COMP_CWORD=1}
-}
+set cmd {COMP_WORDS=(a "'b c"); COMP_CWORD=1}
append cmd {; COMP_LINE="a 'b c"; COMP_POINT=6; _get_comp_words_by_ref cur prev; echo "$cur $prev"}
send "$cmd\r"
expect -ex "$cmd\r\n"
expect {
-ex "'b c a\r\n/@" { pass "$test" }
- -ex "c b\r\n/@" {
- if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
- } {xfail "$test"} {fail "$test"}
- }
+ -ex "c b\r\n/@" { fail "$test" }
}
@@ -125,15 +146,7 @@ sync_after_int
set test {a "b c|}; #"# | = cursor position
-if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
-} {
- set cmd {COMP_WORDS=(a "\"" b c); COMP_CWORD=3}
-} else {
- set cmd {COMP_WORDS=(a "\"b c"); COMP_CWORD=1}
-}
+set cmd {COMP_WORDS=(a "\"b c"); COMP_CWORD=1}
append cmd {; COMP_LINE="a \"b c"; COMP_POINT=6}
assert_bash_exec $cmd
set cmd {_get_comp_words_by_ref cur prev; echo "$cur $prev"};
@@ -141,13 +154,7 @@ send "$cmd\r"
expect -ex "$cmd\r\n"
expect {
-ex "\"b c a\r\n/@" { pass "$test" }
- -ex "c b\r\n/@" {
- if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
- } {xfail "$test"} {fail "$test"}
- }
+ -ex "c b\r\n/@" { fail "$test" }
}
@@ -155,13 +162,8 @@ sync_after_int
set test {a b:c| with WORDBREAKS += :}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a "b:c"); COMP_CWORD=1}
- set expected {"b:c a"}
-} else {
- set cmd {add_comp_wordbreak_char :; COMP_WORDS=(a b : c); COMP_CWORD=3}
- set expected {"c :"}
-}
+set cmd {add_comp_wordbreak_char :; COMP_WORDS=(a b : c); COMP_CWORD=3}
+set expected {"c :"}
append cmd {; COMP_LINE='a b:c'; COMP_POINT=5}
# NOTE: Split-send cmd to prevent backspaces (\008) in output
assert_bash_exec $cmd $test
@@ -173,11 +175,7 @@ sync_after_int
set test {a b:c| with WORDBREAKS -= :}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a "b:c"); COMP_CWORD=1}
-} else {
- set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3}
-}
+set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3}
append cmd {; COMP_LINE='a b:c'; COMP_POINT=5}
assert_bash_exec $cmd $test
set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"}
@@ -188,11 +186,7 @@ sync_after_int
set test {a b c:| with WORDBREAKS -= :}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a b c:); COMP_CWORD=2}
-} else {
- set cmd {COMP_WORDS=(a b c :); COMP_CWORD=3}
-}
+set cmd {COMP_WORDS=(a b c :); COMP_CWORD=3}
append cmd {; COMP_LINE='a b c:'; COMP_POINT=6}
assert_bash_exec $cmd $test
set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"}
@@ -203,11 +197,7 @@ sync_after_int
set test {a b:c | with WORDBREAKS -= :}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a b:c ''); COMP_CWORD=2}
-} else {
- set cmd {COMP_WORDS=(a b : c ''); COMP_CWORD=4}
-}
+set cmd {COMP_WORDS=(a b : c ''); COMP_CWORD=4}
append cmd {; COMP_LINE='a b:c '; COMP_POINT=6}
assert_bash_exec $cmd $test
set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"}
@@ -228,11 +218,7 @@ sync_after_int
set test {a b::| with WORDBREAKS -= : should return b::}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a "b::"); COMP_CWORD=1}
-} else {
- set cmd {COMP_WORDS=(a b ::); COMP_CWORD=2}
-}
+set cmd {COMP_WORDS=(a b ::); COMP_CWORD=2}
append cmd {; COMP_LINE='a b::'; COMP_POINT=5}
assert_bash_exec $cmd
set cmd {_get_comp_words_by_ref -n : cur prev; echo "$cur $prev"}
@@ -264,14 +250,9 @@ assert_bash_list c $cmd $test
sync_after_int
-set test {a b=c| should return b=c (bash-3) or c (bash-4)}; # | = cursor position
-if {[lindex $::BASH_VERSINFO] <= 3} {
- set cmd {COMP_WORDS=(a "b=c"); COMP_CWORD=1}
- set expected b=c
-} else {
- set cmd {COMP_WORDS=(a b = c); COMP_CWORD=3}
- set expected c
-}
+set test {a b=c| should return c}; # | = cursor position
+set cmd {COMP_WORDS=(a b = c); COMP_CWORD=3}
+set expected c
append cmd {; COMP_LINE='a b=c'; COMP_POINT=5}
assert_bash_exec $cmd
set cmd {_get_comp_words_by_ref cur prev; echo "$cur"}
@@ -325,15 +306,7 @@ sync_after_int
set test {a 'b&c| should return 'b&c}; # | = cursor position
-if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
-} {
- set cmd {COMP_WORDS=(a "'" b "&" c); COMP_CWORD=4}
-} else {
- set cmd {COMP_WORDS=(a "'b&c"); COMP_CWORD=1}
-}
+set cmd {COMP_WORDS=(a "'b&c"); COMP_CWORD=1}
append cmd {; COMP_LINE="a 'b&c"; COMP_POINT=6}
assert_bash_exec $cmd
set cmd {_get_comp_words_by_ref cur prev; printf %s "$cur"}
@@ -341,13 +314,7 @@ send "$cmd\r"
expect -ex "$cmd\r\n"
expect {
-ex "'b&c/@" { pass "$test" }
- -ex "c/@" {
- if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
- } {xfail "$test"} {fail "$test"}
- }
+ -ex "c/@" { fail "$test" }
}
@@ -398,4 +365,47 @@ assert_bash_list {"b a a b 1"} $cmd $test
sync_after_int
+set test {a b : c| with WORDBREAKS -= :}; # | = cursor position
+set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3; COMP_LINE='a b : c'; COMP_POINT=7}
+assert_bash_exec $cmd $test
+set cmd {_get_comp_words_by_ref -n : words; echo "${words[@]}"}
+assert_bash_list {"a b : c"} $cmd $test
+
+
+sync_after_int
+
+
+set test {a b: c| with WORDBREAKS -= :}; # | = cursor position
+set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3}
+append cmd {; COMP_LINE='a b: c'; COMP_POINT=6}
+assert_bash_exec $cmd $test
+set cmd {_get_comp_words_by_ref -n : words; echo "${words[@]}"}
+assert_bash_list {"a b: c"} $cmd $test
+
+
+sync_after_int
+
+
+set test {a b :c| with WORDBREAKS -= :}; # | = cursor position
+set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3}
+append cmd {; COMP_LINE='a b :c'; COMP_POINT=6}
+assert_bash_exec $cmd $test
+set cmd {_get_comp_words_by_ref -n : words; echo "${words[@]}"}
+assert_bash_list {"a b :c"} $cmd $test
+
+
+sync_after_int
+
+
+set test {a b\ :c| with WORDBREAKS -= :}; # | = cursor position
+set cmd {COMP_WORDS=(a "b\\ " : c); COMP_CWORD=3}
+append cmd {; COMP_LINE='a b\ :c'; COMP_POINT=7}
+assert_bash_exec $cmd $test
+set cmd {_get_comp_words_by_ref -n : words; echo "${words[@]}"}
+assert_bash_list {a "b\\ :c"} $cmd $test
+
+
+sync_after_int
+
+
teardown
diff --git a/test/unit/_get_cword.exp b/test/unit/_get_cword.exp
index ce749cec..3a582811 100644
--- a/test/unit/_get_cword.exp
+++ b/test/unit/_get_cword.exp
@@ -97,27 +97,13 @@ sync_after_int
set test {a 'b c| should return 'b c}; # | = cursor position
-if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
-} {
- set cmd {COMP_WORDS=(a "'" b c); COMP_CWORD=3}
-} else {
- set cmd {COMP_WORDS=(a "'b c"); COMP_CWORD=1}
-}
+set cmd {COMP_WORDS=(a "'b c"); COMP_CWORD=1}
append cmd {; COMP_LINE="a 'b c"; COMP_POINT=6; _get_cword}
send "$cmd\r"
expect -ex "$cmd\r\n"
expect {
-ex "'b c/@" { pass "$test" }
- -ex "c/@" {
- if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
- } {xfail "$test"} {fail "$test"}
- }
+ -ex "c/@" { fail "$test" }
}
@@ -125,41 +111,22 @@ sync_after_int
set test {a "b c| should return "b c}; # | = cursor position
-if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
-} {
- set cmd {COMP_WORDS=(a "\"" b c); COMP_CWORD=3}
-} else {
- set cmd {COMP_WORDS=(a "\"b c"); COMP_CWORD=1}
-}
+set cmd {COMP_WORDS=(a "\"b c"); COMP_CWORD=1}
append cmd {; COMP_LINE="a \"b c"; COMP_POINT=6; _get_cword};
send "$cmd\r"
expect -ex "$cmd\r\n"
expect {
-ex "\"b c/@" { pass "$test" }
- -ex "c/@" {
- if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
- } {xfail "$test"} {fail "$test"}
- }
+ -ex "c/@" { fail "$test" }
}
sync_after_int
-set test {a b:c| with WORDBREAKS += : should return b:c (bash-3) or c (bash-4)}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a "b:c"); COMP_CWORD=1}
- set expected b:c
-} else {
- set cmd {add_comp_wordbreak_char :; COMP_WORDS=(a b : c); COMP_CWORD=3}
- set expected c
-}
+set test {a b:c| with WORDBREAKS += : should return c}; # | = cursor position
+set cmd {add_comp_wordbreak_char :; COMP_WORDS=(a b : c); COMP_CWORD=3}
+set expected c
append cmd {; COMP_LINE='a b:c'; COMP_POINT=5; _get_cword; echo}
assert_bash_list $expected $cmd $test
@@ -168,11 +135,7 @@ sync_after_int
set test {a b:c| with WORDBREAKS -= : should return b:c}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a "b:c"); COMP_CWORD=1}
-} else {
- set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3}
-}
+set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3}
append cmd {; COMP_LINE='a b:c'; COMP_POINT=5; _get_cword :; echo}
assert_bash_list b:c $cmd $test
@@ -181,11 +144,7 @@ sync_after_int
set test {a b c:| with WORDBREAKS -= : should return c:}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a b c:); COMP_CWORD=2}
-} else {
- set cmd {COMP_WORDS=(a b c :); COMP_CWORD=3}
-}
+set cmd {COMP_WORDS=(a b c :); COMP_CWORD=3}
append cmd {; COMP_LINE='a b c:'; COMP_POINT=6; _get_cword :; echo}
assert_bash_list c: $cmd $test
@@ -202,11 +161,7 @@ sync_after_int
set test {a b::| with WORDBREAKS -= : should return b::}; # | = cursor position
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set cmd {COMP_WORDS=(a "b::"); COMP_CWORD=1}
-} else {
- set cmd {COMP_WORDS=(a b ::); COMP_CWORD=2}
-}
+set cmd {COMP_WORDS=(a b ::); COMP_CWORD=2}
append cmd {; COMP_LINE='a b::'; COMP_POINT=5; _get_cword :; echo}
assert_bash_list b:: $cmd $test
@@ -232,14 +187,9 @@ assert_bash_list c $cmd $test
sync_after_int
-set test {a b=c| should return b=c (bash-3) or c (bash-4)}; # | = cursor position
-if {[lindex $::BASH_VERSINFO] <= 3} {
- set cmd {COMP_WORDS=(a "b=c"); COMP_CWORD=1}
- set expected b=c
-} else {
- set cmd {COMP_WORDS=(a b = c); COMP_CWORD=3}
- set expected c
-}
+set test {a b=c| should return c}; # | = cursor position
+set cmd {COMP_WORDS=(a b = c); COMP_CWORD=3}
+set expected c
append cmd {; COMP_LINE='a b=c'; COMP_POINT=5; _get_cword; echo}
assert_bash_list $expected $cmd $test
@@ -286,27 +236,13 @@ sync_after_int
set test {a 'b&c| should return 'b&c}; # | = cursor position
-if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
-} {
- set cmd {COMP_WORDS=(a "'" b "&" c); COMP_CWORD=4}
-} else {
- set cmd {COMP_WORDS=(a "'b&c"); COMP_CWORD=1}
-}
+set cmd {COMP_WORDS=(a "'b&c"); COMP_CWORD=1}
append cmd {; COMP_LINE="a 'b&c"; COMP_POINT=6; _get_cword}
send "$cmd\r"
expect -ex "$cmd\r\n"
expect {
-ex "'b&c/@" { pass "$test" }
- -ex "c/@" {
- if {
- [lindex $::BASH_VERSINFO 0] == 4 &&
- [lindex $::BASH_VERSINFO 1] == 0 &&
- [lindex $::BASH_VERSINFO 2] < 35
- } {xfail "$test"} {fail "$test"}
- }
+ -ex "c/@" { fail "$test" }
}
diff --git a/test/unit/_init_completion.exp b/test/unit/_init_completion.exp
new file mode 100644
index 00000000..75c41255
--- /dev/null
+++ b/test/unit/_init_completion.exp
@@ -0,0 +1,35 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_bash_exec { \
+ unset COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS cur prev words cword\
+ }
+ assert_env_unmodified {
+ /COMPREPLY=/d
+ }
+}
+
+
+setup
+
+
+set test "function should not pollute environment"
+# NOTE: A possible environment pollution is detected by assert_env_modified() in teardown()
+assert_bash_exec {foo() { local cur prev words cword; _init_completion; }; foo; unset foo} $test
+
+
+sync_after_int
+
+
+set test "|a"; # | = cursor position
+set cmd {COMP_WORDS=(a); COMP_CWORD=0; COMP_LINE='a'; COMP_POINT=0; _init_completion; echo "$cur $prev"}
+assert_bash_list {" "} $cmd $test
+
+
+sync_after_int
+
+
+teardown
diff --git a/test/unit/_known_hosts_real.exp b/test/unit/_known_hosts_real.exp
index 604b2d5e..0e381fa7 100644
--- a/test/unit/_known_hosts_real.exp
+++ b/test/unit/_known_hosts_real.exp
@@ -19,7 +19,7 @@ setup
set test "Hosts should be put in COMPREPLY"
-set hosts [get_hosts]
+set hosts [get_hosts -unsorted]
# Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config
# doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, and bunch of IPv6 test cases in ./fixtures/_known_hosts_real/known_hosts
lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 1111:2222:3333:4444:5555:6666:xxxx:abab 11xx:2222:3333:4444:5555:6666:xxxx:abab ::42
@@ -31,7 +31,7 @@ sync_after_int
set test "Hosts should have username prefix and colon suffix"
-set hosts [get_hosts]
+set hosts [get_hosts -unsorted]
# Hosts `gee', `hus' and `jar' are defined in ./fixtures/_known_hosts_real/config
# doo, ike, jub, 10.0.0.1, kyl, 100.0.0.2, 10.10.0.3, blah, and bunch of IPv6 test cases in ./fixtures/_known_hosts_real/known_hosts
lappend hosts blah doo gee hus ike jar jub kyl 10.0.0.1 100.0.0.2 10.10.0.3 fd00:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:5555 fe80::123:0xff:dead:beef%eth0 1111:2222:3333:4444:5555:6666:xxxx:abab 11xx:2222:3333:4444:5555:6666:xxxx:abab ::42
@@ -49,7 +49,7 @@ sync_after_int
set test "Files containing consecutive spaces should work"
-set hosts [get_hosts]
+set hosts [get_hosts -unsorted]
set hosts_orig $hosts
# Hosts `gee' and `hus' are defined in `./fixtures/_known_hosts_real/spaced conf'
# Host `two' is defined in ./fixtures/_known_hosts_real/known_hosts2
@@ -77,7 +77,7 @@ sync_after_int
set test "Files starting with tilde (~) should work"
-set hosts [get_hosts]
+set hosts [get_hosts -unsorted]
# Host `two' is defined in ./fixtures/_known_hosts_real/known_hosts2
# Host `three' is defined in ./fixtures/_known_hosts_real/known_hosts3
lappend hosts two three
diff --git a/test/unit/_parse_help.exp b/test/unit/_parse_help.exp
index 4beb28d2..a6d58d5a 100644
--- a/test/unit/_parse_help.exp
+++ b/test/unit/_parse_help.exp
@@ -38,11 +38,11 @@ assert_bash_list "-space" $cmd "one dash after space"
sync_after_int
set cmd {fn() { printf '%s\n' "-one -two dashes"; }; _parse_help fn}
-assert_bash_list "-one\n-two" $cmd "two dashes, space-separated"
+assert_bash_list "-one" $cmd "two dashes, space-separated"
sync_after_int
set cmd {fn() { printf '%s\n' "-one,-t dashes"; }; _parse_help fn}
-assert_bash_list "-one\n-t" $cmd "two dashes, comma-separated"
+assert_bash_list "-one" $cmd "two dashes, comma-separated"
sync_after_int
set cmd {fn() { printf '%s\n' "-one dash-inside"; }; _parse_help fn}
@@ -50,23 +50,83 @@ assert_bash_list "-one" $cmd "internal dash 2"
sync_after_int
set cmd {fn() { printf '%s\n' "--long-arg=value"; }; _parse_help fn}
-assert_bash_list "--long-arg" $cmd "value stripped"
+assert_bash_list "--long-arg=" $cmd "value stripped"
sync_after_int
set cmd {fn() { printf '%s\n' "--long-arg=-value"; }; _parse_help fn}
-assert_bash_list "--long-arg" $cmd "value not seen as option"
+assert_bash_list "--long-arg=" $cmd "value not seen as option"
sync_after_int
set cmd {fn() { printf '%s\n' "--long-arg=-value,--opt2=val"; }; _parse_help fn}
-assert_bash_list "--long-arg\n--opt2" $cmd "two options with values"
+assert_bash_list "--long-arg=" $cmd "two options with values"
sync_after_int
set cmd {fn() { printf '%s\n' "-m,--mirror"; }; _parse_help fn}
-assert_bash_list "-m\n--mirror" $cmd "short + long"
+assert_bash_list "--mirror" $cmd "short + long"
sync_after_int
set cmd {fn() { printf '%s\n' "-T/--upload-file"; }; _parse_help fn}
-assert_bash_list "-T\n--upload-file" $cmd "short + long, slash separated"
+assert_bash_list "--upload-file" $cmd "short + long, slash separated"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-T|--upload-file"; }; _parse_help fn}
+assert_bash_list "--upload-file" $cmd "pipe separated"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-f, -F, --foo"; }; _parse_help fn}
+assert_bash_list "--foo" $cmd "short + short + long"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--foo[=bar]"; }; _parse_help fn}
+assert_bash_list "--foo" $cmd "long with value and eq sign in brackets"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--foo=<bar>"; }; _parse_help fn}
+assert_bash_list "--foo=" $cmd "long with value in angle brackets"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--foo={bar,quux}"; }; _parse_help fn}
+assert_bash_list "--foo=" $cmd "long with value in curly brackets"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--[no]foo"; }; _parse_help fn}
+assert_bash_list "--foo\n--nofoo" $cmd "long with \[no\]"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--[no-]bar[=quux]"; }; _parse_help fn}
+assert_bash_list "--bar\n--no-bar" $cmd "long with \[no-\] + optional arg"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--[no-]bar=quux"; }; _parse_help fn}
+assert_bash_list "--bar=\n--no-bar=" $cmd "long with \[no-\] + required arg"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--[dont-]foo"; }; _parse_help fn}
+assert_bash_list "--foo\n--dont-foo" $cmd "long with \[dont-\]"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-[dont]x, --[dont]yy"; }; _parse_help fn}
+assert_bash_list "--yy\n--dontyy" $cmd "short and long with \[dont\]"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "----\n---foo\n----- bar"; }; _parse_help fn}
+assert_bash_list "" $cmd "more than two dashes"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-f FOO, --foo=FOO"; }; _parse_help fn}
+assert_bash_list "--foo=" $cmd "-f FOO, --foo=FOO"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-f [FOO], --foo[=FOO]"; }; _parse_help fn}
+assert_bash_list "--foo" $cmd "-f \[FOO\], --foo\[=FOO\]"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "--foo."; }; _parse_help fn}
+assert_bash_list "--foo" $cmd "--foo."
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "-f or --foo"; }; _parse_help fn}
+assert_bash_list "--foo" $cmd "-f or --foo"
sync_after_int
diff --git a/test/unit/_parse_usage.exp b/test/unit/_parse_usage.exp
new file mode 100644
index 00000000..0069848d
--- /dev/null
+++ b/test/unit/_parse_usage.exp
@@ -0,0 +1,59 @@
+proc setup {} {
+ save_env
+}
+
+proc teardown {} {
+ assert_env_unmodified {
+ /declare -f fn/d
+ }
+}
+
+setup
+
+
+set cmd {fn() { printf '%s\n' ""; }; _parse_usage fn}
+assert_bash_list "" $cmd "empty"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "no dashes here"; }; _parse_usage fn}
+assert_bash_list "" $cmd "no dashes"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "foo [-f]"; }; _parse_usage fn}
+assert_bash_list "-f" $cmd "simple"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "bar [-aBcD] [-e X]"; }; _parse_usage fn}
+assert_bash_list "-a -B -c -D -e" $cmd "bundled + separate 1 short"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "[-[XyZ]] [--long=arg]"; }; _parse_usage fn}
+assert_bash_list "-X -y -Z --long=" $cmd "bundled in brackets + separate long"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "[-s|--long]"; }; _parse_usage fn}
+assert_bash_list "--long" $cmd "short or long"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "[-s, --long=arg]"; }; _parse_usage fn}
+assert_bash_list "--long=" $cmd "short or long with arg, comma"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "[--long/-s] [-S/--longer]"; }; _parse_usage fn}
+assert_bash_list "--long\n--longer" $cmd "long or short, slash"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "[ -a ] [ -b foo ]"; }; _parse_usage fn}
+assert_bash_list "-a\n-b" $cmd "whitespace in brackets"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "[ -a | --aa ]"; }; _parse_usage fn}
+assert_bash_list "--aa" $cmd "whitespace in brackets 2"
+sync_after_int
+
+set cmd {fn() { printf '%s\n' "----\n---foo\n----- bar"; }; _parse_usage fn}
+assert_bash_list "" $cmd "many dashes"
+sync_after_int
+
+
+teardown
diff --git a/test/unit/compgen.exp b/test/unit/compgen.exp
index 6e6f79c6..9fc1efba 100644
--- a/test/unit/compgen.exp
+++ b/test/unit/compgen.exp
@@ -11,31 +11,15 @@ proc teardown {} {
setup
-if {[lindex $::BASH_VERSINFO 0] <= 3} {
- set test {compgen -f a\\\\\\\'b/ on bash-3 should return a\'b/c};
- set cmd {compgen -f a\\\\\\\'b/}
-} else {
- set test {compgen -f a\\\'b/ on bash-4 should return a\'b/c};
- set cmd {compgen -f a\\\'b/}
-}
+set test {compgen -f a\\\'b/ should return a\'b/c}
+set cmd {compgen -f a\\\'b/}
set dir $::srcdir/fixtures/compgen
assert_bash_exec "cd $dir"
send "$cmd\r"
expect -ex "$cmd\r\n"
expect {
- -re {a\\\'b/c} {
- # On bash-3.2, compgen returns inconsequent output
- if {
- [lindex $::BASH_VERSINFO 0] >= 4 || (
- [lindex $::BASH_VERSINFO 0] == 3 &&
- [lindex $::BASH_VERSINFO 1] == 2
- )
- } {pass $test} else {fail $test}
- }
- -re {a'b/c} {
- if {[lindex $::BASH_VERSINFO 0] <= 3 } \
- {pass $test} else {fail $test}
- }
+ -re {a\\\'b/c} { pass $test }
+ -re {a'b/c} { fail $test }
-re /@ { pass "$test" }
-re eof { unresolved "eof" }
}