summaryrefslogtreecommitdiff
path: root/test/lib/completions
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.eti.br>2017-09-25 23:46:54 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.eti.br>2017-09-25 23:46:54 -0300
commit6d88f1055806932d9291f96847d2b691cccda2cd (patch)
tree0ff79eedaa8a239331256048981deedbd0721965 /test/lib/completions
parent059a87a5936cfebfd2d71ab8057002cafb2ea051 (diff)
downloadbash-completion-6d88f1055806932d9291f96847d2b691cccda2cd.tar.gz
New upstream version 2.7upstream/2.7
Diffstat (limited to 'test/lib/completions')
-rw-r--r--test/lib/completions/2to3.exp (renamed from test/lib/completions/indent.exp)4
-rw-r--r--test/lib/completions/7z.exp37
-rw-r--r--test/lib/completions/abook.exp2
-rw-r--r--test/lib/completions/adb.exp18
-rw-r--r--test/lib/completions/alpine.exp18
-rw-r--r--test/lib/completions/ant.exp15
-rw-r--r--test/lib/completions/appdata-validate.exp18
-rw-r--r--test/lib/completions/apt-get.exp13
-rw-r--r--test/lib/completions/arch.exp5
-rw-r--r--test/lib/completions/bind.exp21
-rw-r--r--test/lib/completions/bts.exp21
-rw-r--r--test/lib/completions/ccache.exp25
-rw-r--r--test/lib/completions/cd.exp12
-rw-r--r--test/lib/completions/checksec.exp18
-rw-r--r--test/lib/completions/chkconfig.exp9
-rw-r--r--test/lib/completions/chroot.exp18
-rw-r--r--test/lib/completions/configure.exp8
-rw-r--r--test/lib/completions/createdb.exp4
-rw-r--r--test/lib/completions/createuser.exp18
-rw-r--r--test/lib/completions/curl.exp2
-rw-r--r--test/lib/completions/dcop.exp2
-rw-r--r--test/lib/completions/dd.exp2
-rw-r--r--test/lib/completions/declare.exp26
-rw-r--r--test/lib/completions/deja-dup.exp21
-rw-r--r--test/lib/completions/dpkg.exp14
-rw-r--r--test/lib/completions/dropdb.exp4
-rw-r--r--test/lib/completions/dropuser.exp18
-rw-r--r--test/lib/completions/feh.exp6
-rw-r--r--test/lib/completions/finger.exp4
-rw-r--r--test/lib/completions/flake8.exp18
-rw-r--r--test/lib/completions/freebsd-update.exp18
-rw-r--r--test/lib/completions/function.exp18
-rw-r--r--test/lib/completions/gm.exp27
-rw-r--r--test/lib/completions/gnokii.exp18
-rw-r--r--test/lib/completions/hostname.exp18
-rw-r--r--test/lib/completions/hping3.exp18
-rw-r--r--test/lib/completions/ifdown.exp9
-rw-r--r--test/lib/completions/ifup.exp9
-rw-r--r--test/lib/completions/ip.exp3
-rw-r--r--test/lib/completions/javac.exp3
-rw-r--r--test/lib/completions/jpegoptim.exp18
-rw-r--r--test/lib/completions/jshint.exp18
-rw-r--r--test/lib/completions/kill.exp6
-rw-r--r--test/lib/completions/look.exp2
-rw-r--r--test/lib/completions/ls.exp10
-rw-r--r--test/lib/completions/lz4.exp18
-rw-r--r--test/lib/completions/make.exp38
-rw-r--r--test/lib/completions/man.exp18
-rw-r--r--test/lib/completions/mcrypt.exp4
-rw-r--r--test/lib/completions/mmsitepass.exp2
-rw-r--r--test/lib/completions/mock.exp18
-rw-r--r--test/lib/completions/modinfo.exp7
-rw-r--r--test/lib/completions/modprobe.exp11
-rw-r--r--test/lib/completions/mount.exp81
-rw-r--r--test/lib/completions/mr.exp46
-rw-r--r--test/lib/completions/mysql.exp2
-rw-r--r--test/lib/completions/newgrp.exp18
-rw-r--r--test/lib/completions/newlist.exp2
-rw-r--r--test/lib/completions/openssl.exp3
-rw-r--r--test/lib/completions/optipng.exp18
-rw-r--r--test/lib/completions/pdftotext.exp18
-rw-r--r--test/lib/completions/perl.exp13
-rw-r--r--test/lib/completions/perldoc.exp5
-rw-r--r--test/lib/completions/pine.exp4
-rw-r--r--test/lib/completions/pngfix.exp21
-rw-r--r--test/lib/completions/portsnap.exp18
-rw-r--r--test/lib/completions/puppet.exp3
-rw-r--r--test/lib/completions/pushd.exp18
-rw-r--r--test/lib/completions/py.test.exp21
-rw-r--r--test/lib/completions/pyflakes.exp18
-rw-r--r--test/lib/completions/python.exp24
-rw-r--r--test/lib/completions/pyvenv.exp18
-rw-r--r--test/lib/completions/quotacheck.exp2
-rw-r--r--test/lib/completions/quotaon.exp2
-rw-r--r--test/lib/completions/renice.exp27
-rw-r--r--test/lib/completions/repomanage.exp18
-rw-r--r--test/lib/completions/ri.exp8
-rw-r--r--test/lib/completions/rsync.exp4
-rw-r--r--test/lib/completions/rtcwake.exp2
-rw-r--r--test/lib/completions/scp.exp4
-rw-r--r--test/lib/completions/screen.exp4
-rw-r--r--test/lib/completions/sftp.exp8
-rw-r--r--test/lib/completions/ssh-copy-id.exp8
-rw-r--r--test/lib/completions/ssh-keygen.exp18
-rw-r--r--test/lib/completions/ssh.exp18
-rw-r--r--test/lib/completions/synclient.exp26
-rw-r--r--test/lib/completions/tar.exp118
-rw-r--r--test/lib/completions/timeout.exp21
-rw-r--r--test/lib/completions/tipc.exp18
-rw-r--r--test/lib/completions/udevadm.exp18
-rw-r--r--test/lib/completions/umount.exp83
-rw-r--r--test/lib/completions/unshunt.exp2
-rw-r--r--test/lib/completions/vgcreate.exp2
-rw-r--r--test/lib/completions/wtf.exp2
-rw-r--r--test/lib/completions/zopfli.exp18
-rw-r--r--test/lib/completions/zopflipng.exp18
96 files changed, 1316 insertions, 196 deletions
diff --git a/test/lib/completions/indent.exp b/test/lib/completions/2to3.exp
index 5c5bb1c7..101fbf87 100644
--- a/test/lib/completions/indent.exp
+++ b/test/lib/completions/2to3.exp
@@ -11,9 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "indent --"
-
-
+assert_complete_any "2to3 "
sync_after_int
diff --git a/test/lib/completions/7z.exp b/test/lib/completions/7z.exp
new file mode 100644
index 00000000..4e7e8689
--- /dev/null
+++ b/test/lib/completions/7z.exp
@@ -0,0 +1,37 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified {/OLDPWD=/d}
+}
+
+
+setup
+
+
+assert_complete_any "7z "
+sync_after_int
+
+
+assert_complete "-tzip" "7z a ar -tzi"
+sync_after_int
+
+
+set dir $::srcdir/fixtures/_filedir
+assert_complete_dir "-wa\\ b/" "7z x -wa\\ " $dir "" -nospace
+sync_after_int
+
+
+set dir $::srcdir/fixtures/7z
+assert_complete_dir "a.7z" "7z x " $dir
+sync_after_int
+
+
+set dir $::srcdir/fixtures/7z
+assert_complete_dir "abc" "7z d a.7z " $dir
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/abook.exp b/test/lib/completions/abook.exp
index 43f62729..463a28c0 100644
--- a/test/lib/completions/abook.exp
+++ b/test/lib/completions/abook.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "abook "
+assert_complete_any "abook -"
sync_after_int
diff --git a/test/lib/completions/adb.exp b/test/lib/completions/adb.exp
new file mode 100644
index 00000000..0d41fd2d
--- /dev/null
+++ b/test/lib/completions/adb.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "adb "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/alpine.exp b/test/lib/completions/alpine.exp
new file mode 100644
index 00000000..5ae1901c
--- /dev/null
+++ b/test/lib/completions/alpine.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "alpine -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ant.exp b/test/lib/completions/ant.exp
index acff23ec..bcf87711 100644
--- a/test/lib/completions/ant.exp
+++ b/test/lib/completions/ant.exp
@@ -6,6 +6,7 @@ proc setup {} {
proc teardown {} {
assert_env_unmodified {
/OLDPWD=/d
+ /ANT_ARGS=/d
}
}
@@ -21,4 +22,18 @@ assert_complete_dir "bashcomp clean init realclean" "ant " $::srcdir/fixtures/an
sync_after_int
+assert_complete_dir "named-build" "ant -f named-build.xml " $::srcdir/fixtures/ant
+sync_after_int
+
+
+assert_complete_dir "build-with-import imported-build" "ant -f build-with-import.xml " $::srcdir/fixtures/ant
+sync_after_int
+
+
+assert_bash_exec {OLD_ANT_ARGS=$ANT_ARGS; ANT_ARGS="-f named-build.xml"}
+assert_complete_dir "named-build" "ant " $::srcdir/fixtures/ant "ant with buildfile from ANT_ARGS"
+sync_after_int
+assert_bash_exec {ANT_ARGS=$OLD_ANT_ARGS; unset -v OLD_ANT_ARGS}
+
+
teardown
diff --git a/test/lib/completions/appdata-validate.exp b/test/lib/completions/appdata-validate.exp
new file mode 100644
index 00000000..583c2952
--- /dev/null
+++ b/test/lib/completions/appdata-validate.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "appdata-validate "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/apt-get.exp b/test/lib/completions/apt-get.exp
index 66887bd0..270d6fe8 100644
--- a/test/lib/completions/apt-get.exp
+++ b/test/lib/completions/apt-get.exp
@@ -11,11 +11,14 @@ proc teardown {} {
setup
-set commands {autoclean autoremove build-dep check clean dist-upgrade
- dselect-upgrade install purge remove source update upgrade}
-assert_complete $commands "apt-get "
-
-
+set test "Tab should complete commands"
+set cmd "apt-get "
+send "$cmd\t"
+set expected "^$cmd\r\n.* install .* update .*\r\n/@$cmd$"
+expect {
+ -re $expected { pass "$test" }
+ default { fail "$test" }
+}
sync_after_int
diff --git a/test/lib/completions/arch.exp b/test/lib/completions/arch.exp
index 0550c76b..5bad0e60 100644
--- a/test/lib/completions/arch.exp
+++ b/test/lib/completions/arch.exp
@@ -11,10 +11,7 @@ proc teardown {} {
setup
-set options {--wipe -s --start= -e --end= -q --quiet -h --help}
-assert_complete $options "arch -"
-
-
+assert_complete_any "arch -"
sync_after_int
diff --git a/test/lib/completions/bind.exp b/test/lib/completions/bind.exp
new file mode 100644
index 00000000..09bbaaa1
--- /dev/null
+++ b/test/lib/completions/bind.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "bind -"
+sync_after_int
+
+assert_complete_any "bind k"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/bts.exp b/test/lib/completions/bts.exp
new file mode 100644
index 00000000..38b92b9d
--- /dev/null
+++ b/test/lib/completions/bts.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "bts -"
+sync_after_int
+
+assert_complete "bts "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ccache.exp b/test/lib/completions/ccache.exp
index 156c881a..7cb3103e 100644
--- a/test/lib/completions/ccache.exp
+++ b/test/lib/completions/ccache.exp
@@ -15,4 +15,29 @@ assert_complete_any "ccache -"
sync_after_int
+set test "Tab should offer correct options from partial option"
+assert_complete_partial [list "--cleanup" "--clear"] "ccache" "--clea" $test
+sync_after_int
+
+
+set test "Tab should complete a command after ccache"
+assert_complete [list "stty"] "ccache stt" $test
+sync_after_int
+
+
+set test "Tab should complete a command after ccache --FLAG"
+assert_complete [list "stty"] "ccache --zero-stats stt" $test
+sync_after_int
+
+
+set test "Tab should complete a command's flags after ccache"
+assert_complete [list "--help"] "ccache ls --hel" $test
+sync_after_int
+
+
+set test "Tab should complete a command's flags after ccache --FLAG"
+assert_complete [list "--help"] "ccache --zero-stats ls --hel" $test
+sync_after_int
+
+
teardown
diff --git a/test/lib/completions/cd.exp b/test/lib/completions/cd.exp
index 55bae158..6f36c881 100644
--- a/test/lib/completions/cd.exp
+++ b/test/lib/completions/cd.exp
@@ -4,7 +4,7 @@ proc setup {} {
proc teardown {} {
- assert_env_unmodified
+ assert_env_unmodified {/OLDPWD=/d}
}
@@ -42,7 +42,15 @@ assert_bash_exec "CDPATH=\$PWD";
assert_complete "$::srcdir/fixtures/shared/default/foo.d/" \
"cd $::srcdir/fixtures/shared/default/fo" $test -nospace -expect-cmd-minus fo
sync_after_int
- # Reset CDPATH
+
+assert_bash_exec "unset CDPATH"
+# Assuming no subdirs here
+assert_bash_exec "cd $::srcdir/fixtures/shared/default/foo.d"
+assert_no_complete "cd " "cd shouldn't complete when there are no subdirs or CDPATH"
+sync_after_int
+
+ # Reset PWD and CDPATH
+assert_bash_exec "cd \"\$OLDPWD\""
assert_bash_exec "declare -p OLDCDPATH &>/dev/null && CDPATH=\$OLDCDPATH || unset CDPATH && unset OLDCDPATH"
diff --git a/test/lib/completions/checksec.exp b/test/lib/completions/checksec.exp
new file mode 100644
index 00000000..03abd575
--- /dev/null
+++ b/test/lib/completions/checksec.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "checksec -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/chkconfig.exp b/test/lib/completions/chkconfig.exp
index dae3b3bd..1714144d 100644
--- a/test/lib/completions/chkconfig.exp
+++ b/test/lib/completions/chkconfig.exp
@@ -11,9 +11,16 @@ proc teardown {} {
setup
-assert_complete_any "chkconfig "
+assert_complete_any "chkconfig -"
+sync_after_int
+# systemd may not be running e.g. in a docker container, and listing services
+# will then fail.
+if {[assert_exec {systemctl list-units} "" "" "unsupported" ]} {
+ # TODO test this also if systemctl command is not available at all
+ assert_complete_any "chkconfig "
+}
sync_after_int
diff --git a/test/lib/completions/chroot.exp b/test/lib/completions/chroot.exp
new file mode 100644
index 00000000..ba9f63a1
--- /dev/null
+++ b/test/lib/completions/chroot.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "chroot "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/configure.exp b/test/lib/completions/configure.exp
index b4399cb1..1be8e167 100644
--- a/test/lib/completions/configure.exp
+++ b/test/lib/completions/configure.exp
@@ -1,19 +1,23 @@
proc setup {} {
+ # Make sure our own ./configure is in PATH
+ assert_bash_exec {OLDPATH="$PATH"; PATH="$SRCDIR/..:$PATH"}
save_env
}
proc teardown {} {
assert_env_unmodified
+ assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH}
}
setup
-assert_complete_any "configure --prefix "
-
+assert_complete_any "configure --"
+sync_after_int
+assert_complete_any "configure --prefix "
sync_after_int
diff --git a/test/lib/completions/createdb.exp b/test/lib/completions/createdb.exp
index aafff1b6..234817f9 100644
--- a/test/lib/completions/createdb.exp
+++ b/test/lib/completions/createdb.exp
@@ -11,9 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "createdb "
-
-
+assert_complete_any "createdb -"
sync_after_int
diff --git a/test/lib/completions/createuser.exp b/test/lib/completions/createuser.exp
new file mode 100644
index 00000000..87d4ac87
--- /dev/null
+++ b/test/lib/completions/createuser.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "createuser -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/curl.exp b/test/lib/completions/curl.exp
index 53512bc4..e05c023e 100644
--- a/test/lib/completions/curl.exp
+++ b/test/lib/completions/curl.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "curl -"
+assert_complete_any "curl --h"
sync_after_int
diff --git a/test/lib/completions/dcop.exp b/test/lib/completions/dcop.exp
index 1e27346b..dcff2802 100644
--- a/test/lib/completions/dcop.exp
+++ b/test/lib/completions/dcop.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-if {[assert_exec {dcop} words]} {
+if {[assert_exec {dcop} words "" "untested"]} {
assert_complete $words "dcop "
}
diff --git a/test/lib/completions/dd.exp b/test/lib/completions/dd.exp
index e02e037c..4946e54d 100644
--- a/test/lib/completions/dd.exp
+++ b/test/lib/completions/dd.exp
@@ -18,7 +18,7 @@ sync_after_int
set test "option should be suffixed with ="
-set cmd "dd if"
+set cmd "dd bs"
send "$cmd\t"
expect -ex "$cmd"
expect {
diff --git a/test/lib/completions/declare.exp b/test/lib/completions/declare.exp
new file mode 100644
index 00000000..8830b676
--- /dev/null
+++ b/test/lib/completions/declare.exp
@@ -0,0 +1,26 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "declare -"
+sync_after_int
+
+assert_complete_any "declare +"
+sync_after_int
+
+assert_complete {BASH_ARGC BASH_ARGV} "declare -p BASH_ARG"
+sync_after_int
+
+assert_complete_any "declare -f _parse_"
+sync_after_int
+
+teardown
diff --git a/test/lib/completions/deja-dup.exp b/test/lib/completions/deja-dup.exp
new file mode 100644
index 00000000..d46549cf
--- /dev/null
+++ b/test/lib/completions/deja-dup.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "deja-dup -"
+sync_after_int
+
+assert_no_complete "deja-dup --help "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/dpkg.exp b/test/lib/completions/dpkg.exp
index f358e172..0ea6ded3 100644
--- a/test/lib/completions/dpkg.exp
+++ b/test/lib/completions/dpkg.exp
@@ -12,17 +12,23 @@ setup
assert_complete_any "dpkg --c"
-
-
sync_after_int
- # Build list of installed packages
-if {[assert_exec {dpkg --get-selections | command grep \[\[:space:\]\]install$ | cut -f1} packages]} {
+# Build list of installed packages
+if {[assert_exec {dpkg --get-selections | command grep \[\[:space:\]\]install$ | cut -f1} packages "" "untested"]} {
assert_complete $packages "dpkg -L "
}
+sync_after_int
+set test "dpkg -i ~part should complete to ~full/ if home dir exists"
+# https://bugs.debian.org/864691
+# Create list of users, having existing home dir
+assert_bash_exec {for u in $(compgen -u); do \
+ eval test -d ~$u && echo $u; unset u; done} {} /@ users
+find_unique_completion_pair $users part full
+assert_complete "~$full/" "dpkg -i ~$part" $test -nospace
sync_after_int
diff --git a/test/lib/completions/dropdb.exp b/test/lib/completions/dropdb.exp
index 8f2d5bfb..d68cd48a 100644
--- a/test/lib/completions/dropdb.exp
+++ b/test/lib/completions/dropdb.exp
@@ -11,9 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "dropdb "
-
-
+assert_complete_any "dropdb -"
sync_after_int
diff --git a/test/lib/completions/dropuser.exp b/test/lib/completions/dropuser.exp
new file mode 100644
index 00000000..8b36fa5e
--- /dev/null
+++ b/test/lib/completions/dropuser.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "dropuser "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/feh.exp b/test/lib/completions/feh.exp
index 129e1f4d..28e90d99 100644
--- a/test/lib/completions/feh.exp
+++ b/test/lib/completions/feh.exp
@@ -17,8 +17,10 @@ assert_complete_any "feh "
sync_after_int
-set test "--lis<TAB> should complete \"--list\""
-assert_complete "--list" "feh --lis" $test
+if {[assert_exec {feh --help | grep "man feh" || exit 1} "" "" "unsupported"]} {
+ set test "--lis<TAB> should complete \"--list\""
+ assert_complete "--list" "feh --lis" $test
+}
sync_after_int
diff --git a/test/lib/completions/finger.exp b/test/lib/completions/finger.exp
index f11d11fe..5a3d3e9e 100644
--- a/test/lib/completions/finger.exp
+++ b/test/lib/completions/finger.exp
@@ -14,7 +14,7 @@ setup
set test "Tab should complete usernames"
# Build string list of usernames
set users {}
-foreach u [exec bash -c "compgen -A user"] {
+foreach u [exec bash -c "compgen -A user -S @"] {
lappend users $u
}
assert_complete $users "finger " $test
@@ -24,7 +24,7 @@ sync_after_int
set test "Tab should complete partial username"
-assert_complete_partial [exec bash -c "compgen -A user"] "finger" "" $test -nospace
+assert_complete_partial [exec bash -c "compgen -A user -S @"] "finger" "" $test -nospace
sync_after_int
diff --git a/test/lib/completions/flake8.exp b/test/lib/completions/flake8.exp
new file mode 100644
index 00000000..469f96ed
--- /dev/null
+++ b/test/lib/completions/flake8.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "flake8 "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/freebsd-update.exp b/test/lib/completions/freebsd-update.exp
new file mode 100644
index 00000000..3657ebfd
--- /dev/null
+++ b/test/lib/completions/freebsd-update.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "freebsd-update "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/function.exp b/test/lib/completions/function.exp
new file mode 100644
index 00000000..823811f1
--- /dev/null
+++ b/test/lib/completions/function.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "function _parse_"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gm.exp b/test/lib/completions/gm.exp
new file mode 100644
index 00000000..43f0bce2
--- /dev/null
+++ b/test/lib/completions/gm.exp
@@ -0,0 +1,27 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "gm "
+sync_after_int
+
+assert_complete_any "gm help "
+sync_after_int
+
+assert_complete_any "gm time "
+sync_after_int
+
+assert_no_complete "gm version "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/gnokii.exp b/test/lib/completions/gnokii.exp
new file mode 100644
index 00000000..11bfeb6c
--- /dev/null
+++ b/test/lib/completions/gnokii.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "gnokii "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/hostname.exp b/test/lib/completions/hostname.exp
new file mode 100644
index 00000000..9d9e4963
--- /dev/null
+++ b/test/lib/completions/hostname.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "hostname -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/hping3.exp b/test/lib/completions/hping3.exp
new file mode 100644
index 00000000..991ee3ad
--- /dev/null
+++ b/test/lib/completions/hping3.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "hping3 "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ifdown.exp b/test/lib/completions/ifdown.exp
index 7849f3f7..7341ceb8 100644
--- a/test/lib/completions/ifdown.exp
+++ b/test/lib/completions/ifdown.exp
@@ -11,9 +11,14 @@ proc teardown {} {
setup
-assert_complete_any "ifdown "
-
+if {[info exists ::env(CI)]} {
+ unsupported "ifdown should show completions"
+} else {
+ assert_complete_any "ifdown "
+ sync_after_int
+}
+assert_no_complete "ifdown bash-completion "
sync_after_int
diff --git a/test/lib/completions/ifup.exp b/test/lib/completions/ifup.exp
index 2c1c010e..31b5ade4 100644
--- a/test/lib/completions/ifup.exp
+++ b/test/lib/completions/ifup.exp
@@ -11,9 +11,14 @@ proc teardown {} {
setup
-assert_complete_any "ifup "
-
+if {[info exists ::env(CI)]} {
+ unsupported "ifup should show completions"
+} else {
+ assert_complete_any "ifup "
+ sync_after_int
+}
+assert_no_complete "ifup bash-completion "
sync_after_int
diff --git a/test/lib/completions/ip.exp b/test/lib/completions/ip.exp
index 8f45f6a3..f57712cb 100644
--- a/test/lib/completions/ip.exp
+++ b/test/lib/completions/ip.exp
@@ -12,8 +12,9 @@ setup
assert_complete_any "ip "
+sync_after_int
-
+assert_complete_any "ip a "
sync_after_int
diff --git a/test/lib/completions/javac.exp b/test/lib/completions/javac.exp
index 948fe8c8..83b11d7f 100644
--- a/test/lib/completions/javac.exp
+++ b/test/lib/completions/javac.exp
@@ -12,8 +12,9 @@ setup
assert_complete_any "javac "
+sync_after_int
-
+assert_complete "a/ bashcomp.jar" "javac -cp $::srcdir/fixtures/java/"
sync_after_int
diff --git a/test/lib/completions/jpegoptim.exp b/test/lib/completions/jpegoptim.exp
new file mode 100644
index 00000000..4b735e80
--- /dev/null
+++ b/test/lib/completions/jpegoptim.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "jpegoptim "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/jshint.exp b/test/lib/completions/jshint.exp
new file mode 100644
index 00000000..553883e1
--- /dev/null
+++ b/test/lib/completions/jshint.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "jshint "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/kill.exp b/test/lib/completions/kill.exp
index bc07bc48..9aeb8412 100644
--- a/test/lib/completions/kill.exp
+++ b/test/lib/completions/kill.exp
@@ -11,8 +11,10 @@ proc teardown {} {
setup
-assert_complete_any "kill 1"
-sync_after_int
+if {[assert_bash_type ps]} {
+ assert_complete_any "kill 1"
+ sync_after_int
+}
assert_complete [get_signals] "kill -s "
diff --git a/test/lib/completions/look.exp b/test/lib/completions/look.exp
index 8f93db24..af9a71a8 100644
--- a/test/lib/completions/look.exp
+++ b/test/lib/completions/look.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-if {[assert_exec {look foo | grep ^foo} words]} {
+if {[assert_exec {look foo | grep ^foo} words {} "unsupported"]} {
assert_complete $words "look foo"
}
diff --git a/test/lib/completions/ls.exp b/test/lib/completions/ls.exp
index 0d16ec03..e176e13f 100644
--- a/test/lib/completions/ls.exp
+++ b/test/lib/completions/ls.exp
@@ -14,30 +14,24 @@ setup
if {[assert_exec {ls --help} "" "" "unsupported"]} {
assert_complete_any "ls --"
}
-
-
sync_after_int
-set test "~part should complete to ~full/ if existing dir"
+set test "~part should complete to ~full/ if home dir exists"
# Create list of users, having existing home dir
assert_bash_exec {for u in $(compgen -u); do \
eval test -d ~$u && echo $u; unset u; done} {} /@ users
find_unique_completion_pair $users part full
assert_complete "~$full/" "ls ~$part" $test -nospace
-
-
sync_after_int
-set test "~part should complete to ~full<space> if non-existing dir"
+set test "~part should complete to ~full<space> if home dir does not exist"
# Create list of users, having non-existing home dir
assert_bash_exec {for u in $(compgen -u); do \
eval test -d ~$u || echo $u; unset u; done} {} /@ users
find_unique_completion_pair $users part full
assert_complete "~$full " "ls ~$part" $test -nospace
-
-
sync_after_int
diff --git a/test/lib/completions/lz4.exp b/test/lib/completions/lz4.exp
new file mode 100644
index 00000000..df392939
--- /dev/null
+++ b/test/lib/completions/lz4.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "lz4 "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/make.exp b/test/lib/completions/make.exp
index 977485d2..0c188dba 100644
--- a/test/lib/completions/make.exp
+++ b/test/lib/completions/make.exp
@@ -18,18 +18,50 @@ assert_complete_dir "Makefile" "make -f Ma" $dir $test
sync_after_int
-
set test "\"make <TAB>\" should complete targets"
set dir $::srcdir/fixtures/make
-set targets "all sample install clean"
+set targets "all sample install clean extra_makefile"
+file delete $dir/extra_makefile
assert_complete_dir $targets "make " $dir $test
sync_after_int
+set test "\"make .<TAB>\" should complete hidden targets"
+set dir $::srcdir/fixtures/make
+set targets ".test_passes .cache/"
+assert_complete_dir $targets "make ." $dir $test
+
+
+sync_after_int
+
+
+set test "\"make .cache/<TAB>\" should complete targets"
+set dir $::srcdir/fixtures/make
+set targets "1 2"
+assert_complete_dir $targets "make .cache/" $dir $test
+
+
+sync_after_int
+
+
+# FIXME: for some reason this fails in centos6, even though the behavior
+# appears to be correct; skip in CI for now.
+set test "\"make .cache/.<TAB>\" should complete hidden targets"
+if {[info exists ::env(CI)] && [info exists ::env(DIST)] && $::env(DIST) == "centos6"} {
+ xfail $test
+} else {
+ set dir $::srcdir/fixtures/make
+ set targets ".1 .2"
+ assert_complete_dir $targets "make .cache/." $dir $test \
+ -expect-cmd-minus "."
+ sync_after_int
+}
+
+
set test "\"make <TAB>\" should not show anything in directory without makefile"
-set dir $::srcdir/fixtures/make/empty_dir
+set dir $::srcdir/fixtures/shared/empty_dir
assert_complete_dir "" "make " $dir $test
diff --git a/test/lib/completions/man.exp b/test/lib/completions/man.exp
index 66b565a2..1a031ff1 100644
--- a/test/lib/completions/man.exp
+++ b/test/lib/completions/man.exp
@@ -1,11 +1,19 @@
proc setup {} {
- assert_bash_exec "export MANPATH=$::srcdirabs/fixtures/man"
+ assert_bash_exec "export MANPATH=$::srcdirabs/fixtures/man:$::srcdirabs/tmp/man"
save_env
+
+ if {! [is_cygwin]} { # Colon not allowed in filenames
+ assert_bash_exec {(cd $TESTDIR/tmp && mkdir -p man/man3 && touch man/man3/Bash::Completion.3pm.gz || true)}
+ }
}
proc teardown {} {
assert_env_unmodified {/OLDPWD/d}
+
+ if {! [is_cygwin]} {
+ assert_bash_exec {(cd $TESTDIR/tmp && rm -r man || true)}
+ }
}
@@ -24,10 +32,10 @@ assert_complete_dir oo.1 "man man1/f" $::srcdir/fixtures/man
sync_after_int
-assert_complete "Bash::Completion" "man Bash::C"
-
-
-sync_after_int
+if {! [is_cygwin]} {
+ assert_complete "Bash::Completion" "man Bash::C"
+ sync_after_int
+}
assert_complete_dir "man/quux.8" "man man/" $::srcdir/fixtures/man
diff --git a/test/lib/completions/mcrypt.exp b/test/lib/completions/mcrypt.exp
index 525ccbc3..e194446b 100644
--- a/test/lib/completions/mcrypt.exp
+++ b/test/lib/completions/mcrypt.exp
@@ -12,8 +12,12 @@ setup
assert_complete_any "mcrypt "
+sync_after_int
+assert_complete_any "mcrypt -a "
+sync_after_int
+assert_complete_any "mcrypt -m "
sync_after_int
diff --git a/test/lib/completions/mmsitepass.exp b/test/lib/completions/mmsitepass.exp
index 4dde214f..70d2a126 100644
--- a/test/lib/completions/mmsitepass.exp
+++ b/test/lib/completions/mmsitepass.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "mmsitepass "
+assert_complete_any "mmsitepass -"
sync_after_int
diff --git a/test/lib/completions/mock.exp b/test/lib/completions/mock.exp
new file mode 100644
index 00000000..8190264a
--- /dev/null
+++ b/test/lib/completions/mock.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "mock "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/modinfo.exp b/test/lib/completions/modinfo.exp
index bd8f965c..90e9702a 100644
--- a/test/lib/completions/modinfo.exp
+++ b/test/lib/completions/modinfo.exp
@@ -11,8 +11,11 @@ proc teardown {} {
setup
-set test "in<TAB> should complete modulename"
-assert_complete_any "modinfo in" $test
+set uname [exec bash -c "uname -r"]
+if {[assert_exec "ls /lib/modules/$uname" "" "" "unsupported"]} {
+ set test "in<TAB> should complete modulename"
+ assert_complete_any "modinfo in" $test
+}
sync_after_int
diff --git a/test/lib/completions/modprobe.exp b/test/lib/completions/modprobe.exp
index a1cd6987..b0a530ef 100644
--- a/test/lib/completions/modprobe.exp
+++ b/test/lib/completions/modprobe.exp
@@ -11,15 +11,18 @@ proc teardown {} {
setup
-set test "--remov<TAB> should complete \"--remove\""
-assert_complete "--remove" "modprobe --remov" $test
+set test "--al<TAB> should complete \"--all\""
+assert_complete "--all" "modprobe --al" $test
sync_after_int
-set test "in<TAB> should complete modulename"
-assert_complete_any "modprobe in" $test
+set uname [exec bash -c "uname -r"]
+if {[assert_exec "ls /lib/modules/$uname" "" "" "unsupported"]} {
+ set test "in<TAB> should complete modulename"
+ assert_complete_any "modprobe in" $test
+}
sync_after_int
diff --git a/test/lib/completions/mount.exp b/test/lib/completions/mount.exp
index 1298f36f..fea99b85 100644
--- a/test/lib/completions/mount.exp
+++ b/test/lib/completions/mount.exp
@@ -1,35 +1,9 @@
-# mount completion from fstab can't be tested directly because it
-# (correctly) uses absolute paths. So we create a custom completion which
-# reads from a file in our text fixture instead.
-proc setup_dummy_mnt {} {
- assert_bash_exec {unset COMPREPLY cur}
- assert_bash_exec {unset -f _mnt}
-
- assert_bash_exec { \
- _mnt() { \
- local cur=$(_get_cword); \
- _linux_fstab $(_get_pword) < "$SRCDIRABS/fixtures/mount/test-fstab"; \
- }; \
- complete -F _mnt mnt \
- }
-}
-
-
-proc teardown_dummy_mnt {} {
- assert_bash_exec {unset COMPREPLY cur}
- assert_bash_exec {unset -f _mnt}
- assert_bash_exec {complete -r mnt}
-}
-
-
proc setup {} {
save_env
- setup_dummy_mnt
}
proc teardown {} {
- teardown_dummy_mnt
assert_env_unmodified {/OLDPWD/d}
}
@@ -69,59 +43,4 @@ assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH}
sync_after_int
-set test "Testing internal __linux_fstab_unescape function for mount"
-# One round of slashes is for bash.
-assert_bash_exec {var=one\'two\\040three\\}
-assert_bash_exec {__linux_fstab_unescape var}
-set cmd {echo $var}
-send "$cmd\r"
-expect {
- -ex "$cmd\r\none'two three\\" { pass $test }
-# default { fail $test }
-}
-sync_after_int
-assert_bash_exec {unset var}
-
-
-sync_after_int
-
-
-# Begin testing through mnt (see setup_dummy_mnt).
-assert_complete {/mnt/nice-test-path} {mnt /mnt/nice-test-p}
-sync_after_int
-
-assert_complete {/mnt/nice\ test-path} {mnt /mnt/nice\ test-p}
-sync_after_int
-
-assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$test-p}
-sync_after_int
-
-assert_complete {/mnt/nice\ test\\path} {mnt /mnt/nice\ test\\p}
-sync_after_int
-
-assert_complete {{/mnt/nice\ test\\path} {/mnt/nice\ test-path}} \
- {mnt /mnt/nice\ } "" -expect-cmd-minus {/mnt/nice\ }
-sync_after_int
-
-assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$}
-sync_after_int
-
-assert_complete {/mnt/nice\'test-path} {mnt /mnt/nice\'}
-sync_after_int
-
-assert_complete {/mnt/other\'test\ path} {mnt /mnt/other}
-sync_after_int
-
-assert_complete {Ubuntu\ Karmic} {mnt -L Ubu}
-sync_after_int
-
-assert_complete {Debian-it\'s\ awesome} {mnt -L Deb}
-sync_after_int
-
-# This does not work. Proper support for this requires smarter parsing of
-# $COMP_LINE and it's not worth doing just for mount.
-#assert_complete {$'/mnt/nice\ntest-path'} {mnt $'/mnt/nice\n}
-#sync_after_int
-
-
teardown
diff --git a/test/lib/completions/mr.exp b/test/lib/completions/mr.exp
new file mode 100644
index 00000000..d7d41bb6
--- /dev/null
+++ b/test/lib/completions/mr.exp
@@ -0,0 +1,46 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+setup
+
+assert_complete_any "mr "
+sync_after_int
+
+# Some versions require man to be around for useful output.
+if {[assert_exec {man -h} "" "" "unsupported"]} {
+
+ assert_complete_any "mr --"
+ sync_after_int
+
+ assert_complete {"foo"} "mr -c $::srcdir/fixtures/shared/default/foo.d/"
+ sync_after_int
+
+ assert_complete {"bar bar.d/" "foo.d/"} "mr -d $::srcdir/fixtures/shared/default/"
+ sync_after_int
+
+ assert_complete {"bar" "bar bar.d/" "foo" "foo.d/"} "mr bootstrap $::srcdir/fixtures/shared/default/"
+ sync_after_int
+
+ # Disabled for now; "clean" doesn't exist before mr 1.20141023
+ #assert_complete "-f" "mr clean -"
+ #sync_after_int
+
+ assert_complete "-m" "mr commit -"
+ sync_after_int
+
+ assert_no_complete "mr status "
+ sync_after_int
+
+ # Disabled temporarily: suggesting all commands produces too much output for
+ # test suite.
+ #assert_complete_any "mr run "
+ #sync_after_int
+}
+
+teardown
diff --git a/test/lib/completions/mysql.exp b/test/lib/completions/mysql.exp
index 62a64fc2..b7a50b81 100644
--- a/test/lib/completions/mysql.exp
+++ b/test/lib/completions/mysql.exp
@@ -12,8 +12,10 @@ setup
assert_complete_any "mysql --"
+sync_after_int
+assert_complete_any "mysql --default-character-set="
sync_after_int
diff --git a/test/lib/completions/newgrp.exp b/test/lib/completions/newgrp.exp
new file mode 100644
index 00000000..a5cddb8c
--- /dev/null
+++ b/test/lib/completions/newgrp.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "newgrp "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/newlist.exp b/test/lib/completions/newlist.exp
index 0696ec5e..dfabdc50 100644
--- a/test/lib/completions/newlist.exp
+++ b/test/lib/completions/newlist.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "newlist "
+assert_complete_any "newlist -"
sync_after_int
diff --git a/test/lib/completions/openssl.exp b/test/lib/completions/openssl.exp
index d1357002..3adbbae7 100644
--- a/test/lib/completions/openssl.exp
+++ b/test/lib/completions/openssl.exp
@@ -28,5 +28,8 @@ sync_after_int
assert_complete_any "openssl pkey -cipher "
sync_after_int
+assert_complete_any "openssl dgst -s"
+sync_after_int
+
teardown
diff --git a/test/lib/completions/optipng.exp b/test/lib/completions/optipng.exp
new file mode 100644
index 00000000..0a079190
--- /dev/null
+++ b/test/lib/completions/optipng.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "optipng "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pdftotext.exp b/test/lib/completions/pdftotext.exp
new file mode 100644
index 00000000..4c5cfca5
--- /dev/null
+++ b/test/lib/completions/pdftotext.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pdftotext "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/perl.exp b/test/lib/completions/perl.exp
index f3a51841..3a92a6b9 100644
--- a/test/lib/completions/perl.exp
+++ b/test/lib/completions/perl.exp
@@ -4,7 +4,7 @@ proc setup {} {
proc teardown {} {
- assert_env_unmodified
+ assert_env_unmodified {/PERL5LIB=/d}
}
@@ -117,4 +117,15 @@ sync_after_int
assert_complete_any "perl -m-File::"
sync_after_int
+# Make sure at least our mock Devel::* module is around
+assert_bash_exec {OLDPERL5LIB=$PERL5LIB; export PERL5LIB=$TESTDIR/fixtures/perl}
+
+assert_complete_any "perl -d:"
+sync_after_int
+
+assert_complete_any "perl -dt:"
+sync_after_int
+
+assert_bash_exec {export PERL5LIB=$OLDPERL5LIB; unset -v OLDPERL5LIB}
+
teardown
diff --git a/test/lib/completions/perldoc.exp b/test/lib/completions/perldoc.exp
index a745b55d..3197bf5c 100644
--- a/test/lib/completions/perldoc.exp
+++ b/test/lib/completions/perldoc.exp
@@ -1,4 +1,5 @@
proc setup {} {
+ assert_bash_exec {export PERL5LIB=$SRCDIR/fixtures/perldoc}
save_env
}
@@ -31,4 +32,8 @@ assert_complete_any "perldoc -"
sync_after_int
+assert_complete "BashCompletionModule BashCompletionDoc" "perldoc BashCompletion"
+sync_after_int
+
+
teardown
diff --git a/test/lib/completions/pine.exp b/test/lib/completions/pine.exp
index 622bf064..9919a4cb 100644
--- a/test/lib/completions/pine.exp
+++ b/test/lib/completions/pine.exp
@@ -11,9 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "pine "
-
-
+assert_complete_any "pine -"
sync_after_int
diff --git a/test/lib/completions/pngfix.exp b/test/lib/completions/pngfix.exp
new file mode 100644
index 00000000..d492610d
--- /dev/null
+++ b/test/lib/completions/pngfix.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pngfix "
+sync_after_int
+
+assert_complete_any "pngfix -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/portsnap.exp b/test/lib/completions/portsnap.exp
new file mode 100644
index 00000000..d6028cae
--- /dev/null
+++ b/test/lib/completions/portsnap.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "portsnap "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/puppet.exp b/test/lib/completions/puppet.exp
index 7b7da3e7..8b82a160 100644
--- a/test/lib/completions/puppet.exp
+++ b/test/lib/completions/puppet.exp
@@ -12,8 +12,9 @@ setup
assert_complete_any "puppet "
+sync_after_int
-
+assert_complete_any "puppet agent --"
sync_after_int
diff --git a/test/lib/completions/pushd.exp b/test/lib/completions/pushd.exp
new file mode 100644
index 00000000..54e3ad8b
--- /dev/null
+++ b/test/lib/completions/pushd.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pushd "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/py.test.exp b/test/lib/completions/py.test.exp
new file mode 100644
index 00000000..736b9828
--- /dev/null
+++ b/test/lib/completions/py.test.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "py.test "
+sync_after_int
+
+assert_complete_any "py.test -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/pyflakes.exp b/test/lib/completions/pyflakes.exp
new file mode 100644
index 00000000..22a8cf7c
--- /dev/null
+++ b/test/lib/completions/pyflakes.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pyflakes "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/python.exp b/test/lib/completions/python.exp
index 446e3d09..29a10bf6 100644
--- a/test/lib/completions/python.exp
+++ b/test/lib/completions/python.exp
@@ -17,5 +17,29 @@ sync_after_int
assert_complete_any "python -"
sync_after_int
+assert_no_complete "python -c "
+sync_after_int
+
+assert_complete {"bar bar.d/" foo.d/} "python $::srcdir/fixtures/shared/default/"
+sync_after_int
+
+assert_complete {bar "bar bar.d/" foo foo.d/} "python -c foo $::srcdir/fixtures/shared/default/"
+sync_after_int
+
+assert_no_complete "python -c foo -"
+sync_after_int
+
+assert_no_complete "python -m foo -"
+sync_after_int
+
+assert_complete_any "python -m sy"
+sync_after_int
+
+assert_complete_any "python -W "
+sync_after_int
+
+assert_complete_any "python -Wa"
+sync_after_int
+
teardown
diff --git a/test/lib/completions/pyvenv.exp b/test/lib/completions/pyvenv.exp
new file mode 100644
index 00000000..9eca0e4c
--- /dev/null
+++ b/test/lib/completions/pyvenv.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "pyvenv "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/quotacheck.exp b/test/lib/completions/quotacheck.exp
index 4200da32..353d204a 100644
--- a/test/lib/completions/quotacheck.exp
+++ b/test/lib/completions/quotacheck.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "quotacheck "
+assert_complete_any "quotacheck -"
sync_after_int
diff --git a/test/lib/completions/quotaon.exp b/test/lib/completions/quotaon.exp
index 4acc70e1..b8279e59 100644
--- a/test/lib/completions/quotaon.exp
+++ b/test/lib/completions/quotaon.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "quotaon "
+assert_complete_any "quotaon -"
sync_after_int
diff --git a/test/lib/completions/renice.exp b/test/lib/completions/renice.exp
index fdc859b4..5e25ddea 100644
--- a/test/lib/completions/renice.exp
+++ b/test/lib/completions/renice.exp
@@ -11,32 +11,15 @@ proc teardown {} {
setup
-set test "Tab should show complete process ids"
- # Try completion
-set cmd "renice 1"
-send "$cmd\t"
-expect {
- -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" }
- -re /@ { unresolved "$test at prompt" }
- -re eof { unresolved "eof" }
-}
-
+if {[assert_bash_type ps]} {
-sync_after_int
+ assert_complete_any "renice 1"
+ sync_after_int
+ assert_complete_any "renice -g "
+ sync_after_int
-set test "Tab should show complete process group ids"
- # Try completion
-set cmd "renice -g "
-send "$cmd\t"
-expect {
- -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" }
- -re /@ { unresolved "$test at prompt" }
- -re eof { unresolved "eof" }
}
-sync_after_int
-
-
teardown
diff --git a/test/lib/completions/repomanage.exp b/test/lib/completions/repomanage.exp
new file mode 100644
index 00000000..de5169bc
--- /dev/null
+++ b/test/lib/completions/repomanage.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "repomanage "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ri.exp b/test/lib/completions/ri.exp
index e6661d1b..1210685b 100644
--- a/test/lib/completions/ri.exp
+++ b/test/lib/completions/ri.exp
@@ -1,19 +1,25 @@
proc setup {} {
+ assert_bash_exec {OLDRI="$RI"; export RI="-d $SRCDIR/fixtures/ri"}
save_env
}
proc teardown {} {
assert_env_unmodified
+ assert_bash_exec {RI="$OLDRI"; unset -v OLDRI}
}
setup
-assert_complete_any "ri RI"
+assert_complete_any "ri -"
+sync_after_int
+assert_complete "BashCompletion/ cache.ri" "ri --dump=$::srcdir/fixtures/ri/"
+sync_after_int
+assert_complete "BashCompletion" "ri BashCompletio"
sync_after_int
diff --git a/test/lib/completions/rsync.exp b/test/lib/completions/rsync.exp
index 42b7af8e..accc6569 100644
--- a/test/lib/completions/rsync.exp
+++ b/test/lib/completions/rsync.exp
@@ -4,7 +4,9 @@ proc setup {} {
proc teardown {} {
- assert_env_unmodified
+ assert_env_unmodified {
+ /_scp_path_esc=/d
+ }
}
diff --git a/test/lib/completions/rtcwake.exp b/test/lib/completions/rtcwake.exp
index 21c05eab..81ca3206 100644
--- a/test/lib/completions/rtcwake.exp
+++ b/test/lib/completions/rtcwake.exp
@@ -12,8 +12,6 @@ setup
assert_complete_any "rtcwake "
-
-
sync_after_int
diff --git a/test/lib/completions/scp.exp b/test/lib/completions/scp.exp
index 7cc6eb07..6b06cb25 100644
--- a/test/lib/completions/scp.exp
+++ b/test/lib/completions/scp.exp
@@ -55,13 +55,13 @@ set test "Tab should complete known-hosts"
# Build string list of expected completions
# Get hostnames and give them a colon (:) suffix
- # Hosts `gee' and `hus' are defined in ./fixtures/scp/config
+ # Hosts `gee' and `hut' are defined in ./fixtures/scp/config
# Hosts `blah', `doo' and `ike' are defined in ./fixtures/scp/known_hosts
set expected {}
foreach host [get_hosts] {
lappend expected "$host:"
}
-lappend expected blah: doo: gee: hus: ike:
+lappend expected blah: doo: gee: hut: ike:
# Append local filenames
lappend expected config known_hosts "spaced\\ \\ conf"
assert_complete $expected "scp -F config " $test
diff --git a/test/lib/completions/screen.exp b/test/lib/completions/screen.exp
index 5e585179..f37d5f5f 100644
--- a/test/lib/completions/screen.exp
+++ b/test/lib/completions/screen.exp
@@ -24,6 +24,10 @@ assert_complete_any "screen cat"
sync_after_int
+assert_complete_any "screen -T "
+sync_after_int
+
+
assert_complete_any "screen -T foo cat"
sync_after_int
diff --git a/test/lib/completions/sftp.exp b/test/lib/completions/sftp.exp
index 27fe7511..3c18ddb7 100644
--- a/test/lib/completions/sftp.exp
+++ b/test/lib/completions/sftp.exp
@@ -21,9 +21,9 @@ setup
# Build string list of expected completions
set expected [get_hosts]
- # Hosts `gee' and `hus' are defined in ./fixtures/sftp/config
+ # Hosts `gee' and `hut' are defined in ./fixtures/sftp/config
# Hosts `10.10.10.10', `doo' and `ike' are defined in ./fixtures/sftp/known_hosts
-lappend expected 10.10.10.10 doo gee hus ike
+lappend expected 10.10.10.10 doo gee hut ike
assert_complete $expected "sftp -F config "
@@ -48,9 +48,9 @@ sync_after_int
# Build string list of expected completions
# Get hostnames and give them a colon (:) suffix
set expected [get_hosts]
- # Hosts `gee', `hus' and `jar' are defined in "./fixtures/sftp/spaced conf"
+ # Hosts `gee' and `jar' are defined in "./fixtures/sftp/spaced conf"
# Hosts `10.10.10.10', `doo' and `ike' are defined in ./fixtures/sftp/known_hosts
-lappend expected 10.10.10.10 doo gee hus ike jar
+lappend expected 10.10.10.10 doo gee ike jar
assert_complete $expected "sftp -F spaced\\ \\ conf "
diff --git a/test/lib/completions/ssh-copy-id.exp b/test/lib/completions/ssh-copy-id.exp
index e8b643fd..5abe303d 100644
--- a/test/lib/completions/ssh-copy-id.exp
+++ b/test/lib/completions/ssh-copy-id.exp
@@ -1,10 +1,16 @@
proc setup {} {
save_env
+ # Some old versions of ssh-copy-id won't output even usage if no
+ # identities are found. Try to make sure there is at least one (for CI).
+ assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIR/fixtures/ssh-copy-id}
}
proc teardown {} {
- assert_env_unmodified
+ assert_bash_exec {HOME=$OLDHOME}
+ assert_env_unmodified {
+ /OLDHOME=/d
+ }
}
diff --git a/test/lib/completions/ssh-keygen.exp b/test/lib/completions/ssh-keygen.exp
new file mode 100644
index 00000000..fea2529e
--- /dev/null
+++ b/test/lib/completions/ssh-keygen.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "ssh-keygen -"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/ssh.exp b/test/lib/completions/ssh.exp
index 3ef0bb69..c082558e 100644
--- a/test/lib/completions/ssh.exp
+++ b/test/lib/completions/ssh.exp
@@ -60,7 +60,23 @@ sync_after_int
set test "First argument should complete partial hostname"
-assert_complete_partial [get_known_hosts] ssh "l" $test -ltrim-colon-completions
+# Build string list of hostnames, starting with the character of the first
+# host, unless host starts with a COMP_WORDBREAKS character, e.g. a colon (:).
+# Hosts starting with a COMP_WORDBREAKS character are left out because these
+# are exceptional cases, requiring specific tests.
+set hosts {}
+set char ""
+foreach h [get_known_hosts] {
+ set first [string range $h 0 0]
+ if {$char == "" && [string first $first $::COMP_WORDBREAKS] == -1} {set char $first}
+ if {$char != ""} {
+ # Only append unique hostnames starting with $char
+ if {$first == $char && [lsearch -exact $hosts "$h"] == -1} {
+ lappend hosts "$h"
+ }
+ }
+}
+assert_complete $hosts "ssh $char" $test -ltrim-colon-completions -expect-cmd-minus "$char"
sync_after_int
diff --git a/test/lib/completions/synclient.exp b/test/lib/completions/synclient.exp
new file mode 100644
index 00000000..1e9c7b5b
--- /dev/null
+++ b/test/lib/completions/synclient.exp
@@ -0,0 +1,26 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "synclient -"
+sync_after_int
+
+
+# synclient -l may error out with e.g.
+# Couldn't find synaptics properties. No synaptics driver loaded?
+if {[assert_exec {synclient -l} "" "" "unsupported"]} {
+ assert_complete_any "synclient "
+}
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/tar.exp b/test/lib/completions/tar.exp
index 37f1ae4b..75434e94 100644
--- a/test/lib/completions/tar.exp
+++ b/test/lib/completions/tar.exp
@@ -2,19 +2,131 @@ proc setup {} {
save_env
}
-
proc teardown {} {
- assert_env_unmodified
+ assert_env_unmodified {
+ /OLDPWD=/d
+ /declare -f _tar/d
+ }
}
-
setup
+# Detect whether system's tar is GNU tar
+set cmd "tar --version"
+send "$cmd\r"
+expect "^$cmd\r\n"
+expect {
+ -re "GNU\[^\n\]*\n" {
+ set tar_version gnu
+ }
+ -re ".*\n" {
+ set tar_version unknown
+ }
+}
+sync_after_int
+
+set test "old option: list escaped chars"
+assert_complete_dir "a/b\\'c/" "tar tf escape.tar a/b\\\'" $::srcdir/fixtures/tar $test
+sync_after_int
+
+# TODO: "tar tf escape.tar a/b"
+
+set test "check that any completion done"
assert_complete_any "tar "
+sync_after_int
+
+# Use bsdtar as the it completes to only 'zc zt zx' ('tar' can be GNU tar and it
+# can would have more options)
+set test "old option: mode is not on first place"
+assert_complete {zc zt zx} "bsdtar z" $test
+sync_after_int
+
+set test "old option: test 'f' when mode is not as a first option"
+assert_complete_dir "dir/ dir2/" "tar zfc " $::srcdir/fixtures/tar
+sync_after_int
+
+set test "old option: creating archive and 'f' option"
+assert_complete_dir "dir/ dir2/" "tar cf " $::srcdir/fixtures/tar
+sync_after_int
+
+set test "old option: archive listing"
+assert_complete_dir "dir/fileA dir/fileB dir/fileC" "tar tf archive.tar.xz dir/file" $::srcdir/fixtures/tar
+sync_after_int
+set test "old option: check _second_ option in \"old\" argument"
+assert_complete_dir "dir/ dir2/" "bsdtar cbfvv NOT_EXISTS " $::srcdir/fixtures/tar
+sync_after_int
+
+set test "old option: create and members"
+assert_complete_dir "dir/ dir2/ archive.tar.xz escape.tar" "tar cTfvv NOT_EXISTS DONT_CREATE.tar " $::srcdir/fixtures/tar
+sync_after_int
+set test "old option: extract and archive"
+assert_complete_dir "dir/ dir2/ archive.tar.xz escape.tar" "tar xvf " $::srcdir/fixtures/tar
sync_after_int
+if { "$tar_version" == "gnu" } {
+ set test "check short options"
+ assert_complete_any "tar -c"
+ sync_after_int
+
+ set test "mode not as a first option"
+ assert_complete_dir "dir/ dir2/" "tar -zcf " $::srcdir/fixtures/tar
+ sync_after_int
+
+ # Only directories should be completed.
+ set test "check that we do not suggest re-writing existing archive"
+ assert_complete_dir "dir/ dir2/" "tar -cf " $::srcdir/fixtures/tar
+ sync_after_int
+
+ set test "check --file option"
+ assert_complete_dir "dir/ dir2/" "tar -c --file " $::srcdir/fixtures/tar
+ sync_after_int
+
+ set test "check --file option #2"
+ assert_complete_dir "dir/ dir2/" "tar -cvv --file " $::srcdir/fixtures/tar
+ sync_after_int
+
+ set test "archive listing"
+ assert_complete_dir "dir/fileA dir/fileB dir/fileC" "tar -tf archive.tar.xz dir/file" $::srcdir/fixtures/tar
+ sync_after_int
+
+ set test "archive listing with --file"
+ assert_complete_dir "dir/fileA dir/fileB dir/fileC" "tar -t --file archive.tar.xz dir/file" $::srcdir/fixtures/tar
+ sync_after_int
+
+ # Some random options should work:
+ set test "test random tar's long option #1"
+ assert_complete "--blocking-factor= --block-number" "tar --block" $test
+ sync_after_int
+
+ set test "test random tar's long option #2"
+ assert_complete "--add-file=" "tar --add-fil" $test -nospace
+ sync_after_int
+
+ set test "test random tar's long option #3"
+ assert_complete "--posix" "tar -cf /dev/null --posi" $test
+ sync_after_int
+
+ # --owner
+ set users [exec bash -c "compgen -A user"]
+ set test "test --owner option"
+ assert_complete $users "tar --owner=" $test
+ sync_after_int
+
+ # --group
+ set groups [exec bash -c "compgen -A group"]
+ set test "test --group option"
+ assert_complete $groups "tar --group=" $test
+ sync_after_int
+
+ # use -b for this as -b is still not handled by tar's completion
+ set test "short opt -XXXb <TAB> (arg required)"
+ assert_no_complete "tar -cvvfb " $test
+ sync_after_int
+
+ # TODO: how to test that 'tar -cf<TAB>' completes to 'tar -cf '
+}
teardown
diff --git a/test/lib/completions/timeout.exp b/test/lib/completions/timeout.exp
new file mode 100644
index 00000000..f56c80f3
--- /dev/null
+++ b/test/lib/completions/timeout.exp
@@ -0,0 +1,21 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "timeout -"
+sync_after_int
+
+assert_no_complete "timeout " "1st non-option arg=timeout, shouldn't complete"
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/tipc.exp b/test/lib/completions/tipc.exp
new file mode 100644
index 00000000..dd88de31
--- /dev/null
+++ b/test/lib/completions/tipc.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "tipc "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/udevadm.exp b/test/lib/completions/udevadm.exp
new file mode 100644
index 00000000..87a948a8
--- /dev/null
+++ b/test/lib/completions/udevadm.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "udevadm "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/umount.exp b/test/lib/completions/umount.exp
index 21a2dfa5..e7703d12 100644
--- a/test/lib/completions/umount.exp
+++ b/test/lib/completions/umount.exp
@@ -1,10 +1,36 @@
+# umount completion from fstab can't be tested directly because it
+# (correctly) uses absolute paths. So we create a custom completion which
+# reads from a file in our text fixture instead.
+proc setup_dummy_mnt {} {
+ assert_bash_exec {unset COMPREPLY cur}
+ assert_bash_exec {unset -f _mnt}
+
+ assert_bash_exec { \
+ _mnt() { \
+ local cur=$(_get_cword); \
+ _linux_fstab $(_get_pword) < "$SRCDIRABS/fixtures/mount/test-fstab"; \
+ }; \
+ complete -F _mnt mnt \
+ }
+}
+
+
+proc teardown_dummy_mnt {} {
+ assert_bash_exec {unset COMPREPLY cur}
+ assert_bash_exec {unset -f _mnt}
+ assert_bash_exec {complete -r mnt}
+}
+
+
proc setup {} {
save_env
+ setup_dummy_mnt
}
proc teardown {} {
- assert_env_unmodified
+ teardown_dummy_mnt
+ assert_env_unmodified {/OLDPWD/d}
}
@@ -17,4 +43,59 @@ assert_complete_any "umount "
sync_after_int
+set test "Testing internal __linux_fstab_unescape function for umount"
+# One round of slashes is for bash.
+assert_bash_exec {var=one\'two\\040three\\}
+assert_bash_exec {__linux_fstab_unescape var}
+set cmd {echo $var}
+send "$cmd\r"
+expect {
+ -ex "$cmd\r\none'two three\\" { pass $test }
+# default { fail $test }
+}
+sync_after_int
+assert_bash_exec {unset var}
+
+
+sync_after_int
+
+
+# Begin testing through mnt (see setup_dummy_mnt).
+assert_complete {/mnt/nice-test-path} {mnt /mnt/nice-test-p}
+sync_after_int
+
+assert_complete {/mnt/nice\ test-path} {mnt /mnt/nice\ test-p}
+sync_after_int
+
+assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$test-p}
+sync_after_int
+
+assert_complete {/mnt/nice\ test\\path} {mnt /mnt/nice\ test\\p}
+sync_after_int
+
+assert_complete {{/mnt/nice\ test\\path} {/mnt/nice\ test-path}} \
+ {mnt /mnt/nice\ } "" -expect-cmd-minus {/mnt/nice\ }
+sync_after_int
+
+assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$}
+sync_after_int
+
+assert_complete {/mnt/nice\'test-path} {mnt /mnt/nice\'}
+sync_after_int
+
+assert_complete {/mnt/other\'test\ path} {mnt /mnt/other}
+sync_after_int
+
+assert_complete {Ubuntu\ Karmic} {mnt -L Ubu}
+sync_after_int
+
+assert_complete {Debian-it\'s\ awesome} {mnt -L Deb}
+sync_after_int
+
+# This does not work. Proper support for this requires smarter parsing of
+# $COMP_LINE and it's not worth doing just for umount.
+#assert_complete {$'/mnt/nice\ntest-path'} {mnt $'/mnt/nice\n}
+#sync_after_int
+
+
teardown
diff --git a/test/lib/completions/unshunt.exp b/test/lib/completions/unshunt.exp
index 96cd5860..cac4ce65 100644
--- a/test/lib/completions/unshunt.exp
+++ b/test/lib/completions/unshunt.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "unshunt -"
+assert_complete_any "unshunt --"
sync_after_int
diff --git a/test/lib/completions/vgcreate.exp b/test/lib/completions/vgcreate.exp
index 4cb7dd45..6f3b3e37 100644
--- a/test/lib/completions/vgcreate.exp
+++ b/test/lib/completions/vgcreate.exp
@@ -12,8 +12,10 @@ setup
assert_complete_any "vgcreate -"
+sync_after_int
+assert_no_complete "vgcreate __does_not_exist__"
sync_after_int
diff --git a/test/lib/completions/wtf.exp b/test/lib/completions/wtf.exp
index b1693c80..0080967c 100644
--- a/test/lib/completions/wtf.exp
+++ b/test/lib/completions/wtf.exp
@@ -11,7 +11,7 @@ proc teardown {} {
setup
-assert_complete_any "wtf "
+assert_complete_any "wtf A"
sync_after_int
diff --git a/test/lib/completions/zopfli.exp b/test/lib/completions/zopfli.exp
new file mode 100644
index 00000000..15738ff0
--- /dev/null
+++ b/test/lib/completions/zopfli.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "zopfli "
+sync_after_int
+
+
+teardown
diff --git a/test/lib/completions/zopflipng.exp b/test/lib/completions/zopflipng.exp
new file mode 100644
index 00000000..9c421a14
--- /dev/null
+++ b/test/lib/completions/zopflipng.exp
@@ -0,0 +1,18 @@
+proc setup {} {
+ save_env
+}
+
+
+proc teardown {} {
+ assert_env_unmodified
+}
+
+
+setup
+
+
+assert_complete_any "zopflipng "
+sync_after_int
+
+
+teardown