diff options
Diffstat (limited to 'test/lib/completions')
80 files changed, 1185 insertions, 58 deletions
diff --git a/test/lib/completions/alias.exp b/test/lib/completions/alias.exp index 9dba4e62..2010df2d 100644 --- a/test/lib/completions/alias.exp +++ b/test/lib/completions/alias.exp @@ -19,8 +19,6 @@ set test "Tab should complete alias" # Try completion set cmd "alias " assert_complete {bar foo} $cmd $test - - sync_after_int @@ -35,9 +33,12 @@ expect { -re /@ { unresolved "$test" } default { unresolved "$test" } } +sync_after_int -sync_after_int +# FIXME: test case for "alias foo=<TAB>" -> "alias foo='bar'", this doesn't work +#assert_complete {foo='bar'} "alias foo=" "" -nospace +#sync_after_int teardown diff --git a/test/lib/completions/apt-get.exp b/test/lib/completions/apt-get.exp index 270d6fe8..8a5d3629 100644 --- a/test/lib/completions/apt-get.exp +++ b/test/lib/completions/apt-get.exp @@ -4,7 +4,7 @@ proc setup {} { proc teardown {} { - assert_env_unmodified + assert_env_unmodified {/OLDPWD=/d} } @@ -22,4 +22,8 @@ expect { sync_after_int +assert_complete_dir "./bash-completion-test-subject.deb" "apt-get install ./" "$::srcdir/fixtures/dpkg" +sync_after_int + + teardown diff --git a/test/lib/completions/bzip2.exp b/test/lib/completions/bzip2.exp index 2813dd0e..d806851a 100644 --- a/test/lib/completions/bzip2.exp +++ b/test/lib/completions/bzip2.exp @@ -17,4 +17,8 @@ assert_complete_any "bzip2 " sync_after_int +assert_complete_homedir "bzip" +sync_after_int + + teardown diff --git a/test/lib/completions/ccze.exp b/test/lib/completions/ccze.exp new file mode 100644 index 00000000..94b51b39 --- /dev/null +++ b/test/lib/completions/ccze.exp @@ -0,0 +1,27 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "ccze " +sync_after_int + +assert_no_complete "ccze -? " +sync_after_int + +assert_complete_any "ccze -o " +sync_after_int + +assert_complete_any "ccze --plugin=" +sync_after_int + + +teardown diff --git a/test/lib/completions/cfrun.exp b/test/lib/completions/cfrun.exp new file mode 100644 index 00000000..2cf6a4cb --- /dev/null +++ b/test/lib/completions/cfrun.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "cfrun -" +sync_after_int + + +teardown diff --git a/test/lib/completions/chfn.exp b/test/lib/completions/chfn.exp new file mode 100644 index 00000000..ea977c76 --- /dev/null +++ b/test/lib/completions/chfn.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "chfn " +sync_after_int + + +teardown diff --git a/test/lib/completions/complete.exp b/test/lib/completions/complete.exp new file mode 100644 index 00000000..9d898c51 --- /dev/null +++ b/test/lib/completions/complete.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "complete -" +sync_after_int + + +teardown diff --git a/test/lib/completions/cpan2dist.exp b/test/lib/completions/cpan2dist.exp new file mode 100644 index 00000000..1c7836ad --- /dev/null +++ b/test/lib/completions/cpan2dist.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "cpan2dist -" +sync_after_int + + +teardown diff --git a/test/lib/completions/dpkg.exp b/test/lib/completions/dpkg.exp index 0ea6ded3..b69f79fd 100644 --- a/test/lib/completions/dpkg.exp +++ b/test/lib/completions/dpkg.exp @@ -22,13 +22,7 @@ if {[assert_exec {dpkg --get-selections | command grep \[\[:space:\]\]install$ | 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 +assert_complete_homedir "dpkg -i" sync_after_int diff --git a/test/lib/completions/ebtables.exp b/test/lib/completions/ebtables.exp new file mode 100644 index 00000000..e8feea55 --- /dev/null +++ b/test/lib/completions/ebtables.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "ebtables -" +sync_after_int + + +teardown diff --git a/test/lib/completions/flake8.exp b/test/lib/completions/flake8.exp index 469f96ed..146ff04d 100644 --- a/test/lib/completions/flake8.exp +++ b/test/lib/completions/flake8.exp @@ -14,5 +14,11 @@ setup assert_complete_any "flake8 " sync_after_int +assert_complete_any "flake8 -" +sync_after_int + +assert_no_complete "flake8 --doesnt-exist=" +sync_after_int + teardown diff --git a/test/lib/completions/freeciv-gtk2.exp b/test/lib/completions/freeciv-gtk2.exp new file mode 100644 index 00000000..1c0ec474 --- /dev/null +++ b/test/lib/completions/freeciv-gtk2.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "freeciv-gtk2 -" +sync_after_int + + +teardown diff --git a/test/lib/completions/freeciv-server.exp b/test/lib/completions/freeciv-server.exp new file mode 100644 index 00000000..a9431848 --- /dev/null +++ b/test/lib/completions/freeciv-server.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "freeciv-server -" +sync_after_int + + +teardown diff --git a/test/lib/completions/geoiplookup.exp b/test/lib/completions/geoiplookup.exp new file mode 100644 index 00000000..89166401 --- /dev/null +++ b/test/lib/completions/geoiplookup.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "geoiplookup -" +sync_after_int + + +teardown diff --git a/test/lib/completions/getconf.exp b/test/lib/completions/getconf.exp new file mode 100644 index 00000000..a599fed1 --- /dev/null +++ b/test/lib/completions/getconf.exp @@ -0,0 +1,30 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "getconf P" +sync_after_int + +assert_complete_any "getconf -" +sync_after_int + +assert_complete_any "getconf -a " +sync_after_int + +assert_complete_any "getconf -v " +sync_after_int + +assert_complete_any "getconf PATH_MAX " +sync_after_int + + +teardown diff --git a/test/lib/completions/gpg2.exp b/test/lib/completions/gpg2.exp new file mode 100644 index 00000000..3bc0e7a7 --- /dev/null +++ b/test/lib/completions/gpg2.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "gpg2 --h" +sync_after_int + + +teardown diff --git a/test/lib/completions/groupadd.exp b/test/lib/completions/groupadd.exp new file mode 100644 index 00000000..c9a4f067 --- /dev/null +++ b/test/lib/completions/groupadd.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_no_complete "groupadd " +sync_after_int + +assert_complete_any "groupadd -" +sync_after_int + + +teardown diff --git a/test/lib/completions/groupdel.exp b/test/lib/completions/groupdel.exp new file mode 100644 index 00000000..07c77638 --- /dev/null +++ b/test/lib/completions/groupdel.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "groupdel " +sync_after_int + + +teardown diff --git a/test/lib/completions/groupmems.exp b/test/lib/completions/groupmems.exp new file mode 100644 index 00000000..41c4b43e --- /dev/null +++ b/test/lib/completions/groupmems.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "groupmems -" +sync_after_int + + +teardown diff --git a/test/lib/completions/groupmod.exp b/test/lib/completions/groupmod.exp new file mode 100644 index 00000000..451456b3 --- /dev/null +++ b/test/lib/completions/groupmod.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "groupmod " +sync_after_int + +assert_complete_any "groupmod -" +sync_after_int + + +teardown diff --git a/test/lib/completions/gzip.exp b/test/lib/completions/gzip.exp index 32acf428..95f774c6 100644 --- a/test/lib/completions/gzip.exp +++ b/test/lib/completions/gzip.exp @@ -25,4 +25,8 @@ expect { sync_after_int +assert_complete_homedir "gzip" +sync_after_int + + teardown diff --git a/test/lib/completions/hid2hci.exp b/test/lib/completions/hid2hci.exp new file mode 100644 index 00000000..c090c2c9 --- /dev/null +++ b/test/lib/completions/hid2hci.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "hid2hci -" +sync_after_int + + +teardown diff --git a/test/lib/completions/info.exp b/test/lib/completions/info.exp index e7c79e6e..443a1305 100644 --- a/test/lib/completions/info.exp +++ b/test/lib/completions/info.exp @@ -1,19 +1,22 @@ proc setup {} { + assert_bash_exec {OLDINFOPATH=$INFOPATH; INFOPATH=$INFOPATH:$TESTDIR/fixtures/info:} save_env } proc teardown {} { assert_env_unmodified + assert_bash_exec {INFOPATH="$OLDINFOPATH"; unset -v OLDINFOPATH} } setup -assert_complete_any "info " - +assert_complete_any "info bash" +sync_after_int +assert_complete_any "info -" sync_after_int diff --git a/test/lib/completions/iptables.exp b/test/lib/completions/iptables.exp new file mode 100644 index 00000000..8ab42f56 --- /dev/null +++ b/test/lib/completions/iptables.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "iptables -" +sync_after_int + + +teardown diff --git a/test/lib/completions/java.exp b/test/lib/completions/java.exp index 864aabd6..62f6fd9d 100644 --- a/test/lib/completions/java.exp +++ b/test/lib/completions/java.exp @@ -44,7 +44,7 @@ assert_no_complete "java -cp \"\" " sync_after_int -assert_complete "a/ bashcomp.jar" "java -jar $::srcdir/fixtures/java/" +assert_complete "a/ bashcomp.jar bashcomp.war" "java -jar $::srcdir/fixtures/java/" sync_after_int diff --git a/test/lib/completions/kcov.exp b/test/lib/completions/kcov.exp index c39f53e7..c6c4a06d 100644 --- a/test/lib/completions/kcov.exp +++ b/test/lib/completions/kcov.exp @@ -12,15 +12,13 @@ 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 - +assert_complete_any "kcov -l 42," sync_after_int diff --git a/test/lib/completions/killall.exp b/test/lib/completions/killall.exp index feec9337..a55ac591 100644 --- a/test/lib/completions/killall.exp +++ b/test/lib/completions/killall.exp @@ -11,15 +11,12 @@ proc teardown {} { setup -assert_complete_any "killall " - - +# "p": Assume that our process name completion runs ps +assert_complete_any "killall p" sync_after_int assert_complete [get_signals] "killall --signal " - - sync_after_int diff --git a/test/lib/completions/ktutil.exp b/test/lib/completions/ktutil.exp new file mode 100644 index 00000000..709a0850 --- /dev/null +++ b/test/lib/completions/ktutil.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "ktutil " +sync_after_int + +assert_complete_any "ktutil -" +sync_after_int + + +teardown diff --git a/test/lib/completions/lintian-info.exp b/test/lib/completions/lintian-info.exp new file mode 100644 index 00000000..5bde97fd --- /dev/null +++ b/test/lib/completions/lintian-info.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "lintian-info " +sync_after_int + +assert_complete_any "lintian-info --" +sync_after_int + + +teardown diff --git a/test/lib/completions/lintian.exp b/test/lib/completions/lintian.exp new file mode 100644 index 00000000..5b1e695c --- /dev/null +++ b/test/lib/completions/lintian.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "lintian --" +sync_after_int + + +teardown diff --git a/test/lib/completions/lrzip.exp b/test/lib/completions/lrzip.exp index 97bc1235..2c4218ec 100644 --- a/test/lib/completions/lrzip.exp +++ b/test/lib/completions/lrzip.exp @@ -17,4 +17,8 @@ assert_complete_any "lrzip " sync_after_int +assert_complete_homedir "lrzip" +sync_after_int + + teardown diff --git a/test/lib/completions/ls.exp b/test/lib/completions/ls.exp index e176e13f..24fc46f8 100644 --- a/test/lib/completions/ls.exp +++ b/test/lib/completions/ls.exp @@ -17,12 +17,7 @@ if {[assert_exec {ls --help} "" "" "unsupported"]} { sync_after_int -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 +assert_complete_homedir "ls" sync_after_int @@ -30,8 +25,11 @@ 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 +if {![find_unique_completion_pair $users part full]} { + untested "Not running, no suitable test user found: $test" +} else { + assert_complete "~$full " "ls ~$part" $test -nospace +} sync_after_int diff --git a/test/lib/completions/lspci.exp b/test/lib/completions/lspci.exp new file mode 100644 index 00000000..ea9e859f --- /dev/null +++ b/test/lib/completions/lspci.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "lspci -" +sync_after_int + +assert_complete_any "lspci -A " +sync_after_int + + +teardown diff --git a/test/lib/completions/lsscsi.exp b/test/lib/completions/lsscsi.exp new file mode 100644 index 00000000..66603142 --- /dev/null +++ b/test/lib/completions/lsscsi.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_no_complete "lsscsi " +sync_after_int + +assert_complete_any "lsscsi -" +sync_after_int + + +teardown diff --git a/test/lib/completions/lsusb.exp b/test/lib/completions/lsusb.exp new file mode 100644 index 00000000..dddb6352 --- /dev/null +++ b/test/lib/completions/lsusb.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "lsusb -" +sync_after_int + + +teardown diff --git a/test/lib/completions/lz4.exp b/test/lib/completions/lz4.exp index df392939..dc41f919 100644 --- a/test/lib/completions/lz4.exp +++ b/test/lib/completions/lz4.exp @@ -14,5 +14,8 @@ setup assert_complete_any "lz4 " sync_after_int +assert_complete_homedir "lz4" +sync_after_int + teardown diff --git a/test/lib/completions/lzma.exp b/test/lib/completions/lzma.exp index ba57d10b..16b45d0b 100644 --- a/test/lib/completions/lzma.exp +++ b/test/lib/completions/lzma.exp @@ -23,4 +23,8 @@ assert_complete "a/ bashcomp.lzma bashcomp.tlz" "lzma -d $::srcdir/fixtures/xz/" sync_after_int +assert_complete_homedir "lzma" +sync_after_int + + teardown diff --git a/test/lib/completions/lzop.exp b/test/lib/completions/lzop.exp index a7d3da25..3084fd3e 100644 --- a/test/lib/completions/lzop.exp +++ b/test/lib/completions/lzop.exp @@ -17,4 +17,8 @@ assert_complete_any "lzop " sync_after_int +assert_complete_homedir "lzop" +sync_after_int + + teardown diff --git a/test/lib/completions/man.exp b/test/lib/completions/man.exp index 1a031ff1..d601c434 100644 --- a/test/lib/completions/man.exp +++ b/test/lib/completions/man.exp @@ -9,7 +9,10 @@ proc setup {} { proc teardown {} { - assert_env_unmodified {/OLDPWD/d} + assert_env_unmodified { + /OLDPWD/d + /OLDMANPATH/d + } if {! [is_cygwin]} { assert_bash_exec {(cd $TESTDIR/tmp && rm -r man || true)} @@ -20,26 +23,54 @@ proc teardown {} { setup -assert_complete "bar" "man b" - +# Something we assume a system installed man page present for +set assumed_present "man" +assert_complete "bash-completion-testcase" "man bash-completion-testcas" sync_after_int - assert_complete_dir oo.1 "man man1/f" $::srcdir/fixtures/man - - 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 sync_after_int +set desc "man $assumed_present with MANPATH having no leading/trailing colon" +assert_no_complete "man $assumed_present" "$desc should not complete" +sync_after_int + +# Trailing colon in MANPATH: append system default search path +assert_bash_exec "OLDMANPATH=\$MANPATH; MANPATH=\$MANPATH:" +set desc "with trailing colon in MANPATH" + +set cmd "man $assumed_present" +assert_complete_any "$cmd" "$cmd $desc should complete" +sync_after_int + +set cmd "man bash-completion-testcas" +assert_complete "bash-completion-testcase" "$cmd" "$cmd $desc should complete" +sync_after_int + +assert_bash_exec "MANPATH=\$OLDMANPATH" + +# Leading colon in MANPATH: prepend system default search path +assert_bash_exec "OLDMANPATH=\$MANPATH; MANPATH=:\$MANPATH" +set desc "with leading colon in MANPATH" + +set cmd "man $assumed_present" +assert_complete_any "$cmd" "$cmd $desc should complete" +sync_after_int + +set cmd "man bash-completion-testcas" +assert_complete "bash-completion-testcase" "$cmd" "$cmd $desc should complete" +sync_after_int + +assert_bash_exec "MANPATH=\$OLDMANPATH" + teardown diff --git a/test/lib/completions/mencoder.exp b/test/lib/completions/mencoder.exp index db29f66a..cb0ba7c5 100644 --- a/test/lib/completions/mencoder.exp +++ b/test/lib/completions/mencoder.exp @@ -1,10 +1,14 @@ proc setup {} { save_env + assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIR/fixtures/mplayer} } proc teardown {} { - assert_env_unmodified + assert_bash_exec {HOME=$OLDHOME} + assert_env_unmodified { + /OLDHOME=/d + } } @@ -12,8 +16,9 @@ setup assert_complete_any "mencoder " +sync_after_int - +assert_complete_any "mencoder -v" sync_after_int diff --git a/test/lib/completions/mkdir.exp b/test/lib/completions/mkdir.exp index 44e87cee..049212f0 100644 --- a/test/lib/completions/mkdir.exp +++ b/test/lib/completions/mkdir.exp @@ -17,14 +17,14 @@ assert_complete_any "mkdir " sync_after_int -assert_complete {"bar bar.d/" foo.d/} "mkdir $::srcdir/fixtures/shared/default/" +assert_complete {bar "bar bar.d/" foo 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/" +set test "mkdir should complete files with nospace" +assert_complete {foo} "mkdir $::srcdir/fixtures/shared/default/foo.d/" $test -nospace sync_after_int diff --git a/test/lib/completions/mplayer.exp b/test/lib/completions/mplayer.exp index 9230a86d..8c9de756 100644 --- a/test/lib/completions/mplayer.exp +++ b/test/lib/completions/mplayer.exp @@ -1,10 +1,14 @@ proc setup {} { save_env + assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIR/fixtures/mplayer} } proc teardown {} { - assert_env_unmodified + assert_bash_exec {HOME=$OLDHOME} + assert_env_unmodified { + /OLDHOME=/d + } } @@ -12,8 +16,9 @@ setup assert_complete_any "mplayer " +sync_after_int - +assert_complete_any "mplayer -h" sync_after_int diff --git a/test/lib/completions/munin-node-configure.exp b/test/lib/completions/munin-node-configure.exp new file mode 100644 index 00000000..2e17f3eb --- /dev/null +++ b/test/lib/completions/munin-node-configure.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "munin-node-configure --libdir " +sync_after_int + + +teardown diff --git a/test/lib/completions/munin-run.exp b/test/lib/completions/munin-run.exp new file mode 100644 index 00000000..25a639bc --- /dev/null +++ b/test/lib/completions/munin-run.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "munin-run -" +sync_after_int + + +teardown diff --git a/test/lib/completions/munindoc.exp b/test/lib/completions/munindoc.exp new file mode 100644 index 00000000..62a4307c --- /dev/null +++ b/test/lib/completions/munindoc.exp @@ -0,0 +1,19 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +# Assume at least munin* available +assert_complete_any "munindoc m" +sync_after_int + + +teardown diff --git a/test/lib/completions/nmap.exp b/test/lib/completions/nmap.exp new file mode 100644 index 00000000..02aab991 --- /dev/null +++ b/test/lib/completions/nmap.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "nmap --v" +sync_after_int + + +teardown diff --git a/test/lib/completions/nproc.exp b/test/lib/completions/nproc.exp new file mode 100644 index 00000000..d6df0472 --- /dev/null +++ b/test/lib/completions/nproc.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_no_complete "nproc " +sync_after_int + +assert_complete_any "nproc -" +sync_after_int + + +teardown diff --git a/test/lib/completions/oggdec.exp b/test/lib/completions/oggdec.exp new file mode 100644 index 00000000..18b0f949 --- /dev/null +++ b/test/lib/completions/oggdec.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "oggdec " +sync_after_int + +assert_complete_any "oggdec --" +sync_after_int + + +teardown diff --git a/test/lib/completions/perltidy.exp b/test/lib/completions/perltidy.exp new file mode 100644 index 00000000..09fa2b14 --- /dev/null +++ b/test/lib/completions/perltidy.exp @@ -0,0 +1,27 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "perltidy " +sync_after_int + +assert_complete_any "perltidy -h" +sync_after_int + +assert_complete_any "perltidy -ole=" +sync_after_int + +assert_no_complete "perltidy -doesntexist=" +sync_after_int + + +teardown diff --git a/test/lib/completions/pgrep.exp b/test/lib/completions/pgrep.exp index c27c4f21..c6276f71 100644 --- a/test/lib/completions/pgrep.exp +++ b/test/lib/completions/pgrep.exp @@ -11,9 +11,8 @@ proc teardown {} { setup -assert_complete_any "pgrep " - - +# "p": Assume that our process name completion runs ps +assert_complete_any "pgrep p" sync_after_int diff --git a/test/lib/completions/pidof.exp b/test/lib/completions/pidof.exp index 8fdab978..d8ab9e8c 100644 --- a/test/lib/completions/pidof.exp +++ b/test/lib/completions/pidof.exp @@ -11,9 +11,8 @@ proc teardown {} { setup -assert_complete_any "pidof " - - +# "p": Assume that our process name completion runs ps +assert_complete_any "pidof p" sync_after_int diff --git a/test/lib/completions/pinfo.exp b/test/lib/completions/pinfo.exp index 3af44044..de241ff5 100644 --- a/test/lib/completions/pinfo.exp +++ b/test/lib/completions/pinfo.exp @@ -1,19 +1,22 @@ proc setup {} { + assert_bash_exec {OLDINFOPATH=$INFOPATH; INFOPATH=$INFOPATH:$TESTDIR/fixtures/info:} save_env } proc teardown {} { assert_env_unmodified + assert_bash_exec {INFOPATH="$OLDINFOPATH"; unset -v OLDINFOPATH} } setup -assert_complete_any "pinfo " - +assert_complete_any "pinfo bash" +sync_after_int +assert_complete_any "pinfo -" sync_after_int diff --git a/test/lib/completions/pm-hibernate.exp b/test/lib/completions/pm-hibernate.exp new file mode 100644 index 00000000..1a20603d --- /dev/null +++ b/test/lib/completions/pm-hibernate.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pm-hibernate -" +sync_after_int + + +teardown diff --git a/test/lib/completions/pm-is-supported.exp b/test/lib/completions/pm-is-supported.exp new file mode 100644 index 00000000..8bd136ff --- /dev/null +++ b/test/lib/completions/pm-is-supported.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pm-is-supported -" +sync_after_int + + +teardown diff --git a/test/lib/completions/pm-powersave.exp b/test/lib/completions/pm-powersave.exp new file mode 100644 index 00000000..dea37139 --- /dev/null +++ b/test/lib/completions/pm-powersave.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pm-powersave " +sync_after_int + + +teardown diff --git a/test/lib/completions/postconf.exp b/test/lib/completions/postconf.exp index 40349061..a7f26714 100644 --- a/test/lib/completions/postconf.exp +++ b/test/lib/completions/postconf.exp @@ -10,10 +10,19 @@ proc teardown {} { setup +# Broken configs may abort output of postconf halfway through, so use +# something from early output to not trigger false positives because of +# this. For example, inet_protocols=all but no IPv6 configured: +# postconf: fatal: parameter inet_interfaces: no local interface found for ::1 +# ...and output can be cut off somewhere near lmtp_tls_secur*. +# ...or be completely missing, so all we can do is to skip. +set test "\"postconf al\" should complete al* variables" +if {[assert_exec {postconf} "" "" "untested"]} { + assert_complete_any "postconf al" +} +sync_after_int -assert_complete_any "postconf p" - - +assert_complete_any "postconf -" sync_after_int diff --git a/test/lib/completions/pv.exp b/test/lib/completions/pv.exp new file mode 100644 index 00000000..64d685ae --- /dev/null +++ b/test/lib/completions/pv.exp @@ -0,0 +1,24 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pv " +sync_after_int + +assert_complete_any "pv -" +sync_after_int + +assert_complete_any "pv --pidfile " +sync_after_int + + +teardown diff --git a/test/lib/completions/pycodestyle.exp b/test/lib/completions/pycodestyle.exp new file mode 100644 index 00000000..a4d095e0 --- /dev/null +++ b/test/lib/completions/pycodestyle.exp @@ -0,0 +1,24 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pycodestyle " +sync_after_int + +assert_complete_any "pycodestyle -" +sync_after_int + +assert_no_complete "pycodestyle --doesnt-exist=" +sync_after_int + + +teardown diff --git a/test/lib/completions/python.exp b/test/lib/completions/python.exp index 29a10bf6..be0e8a2d 100644 --- a/test/lib/completions/python.exp +++ b/test/lib/completions/python.exp @@ -35,6 +35,9 @@ sync_after_int assert_complete_any "python -m sy" sync_after_int +assert_complete_any "python -m json." +sync_after_int + assert_complete_any "python -W " sync_after_int diff --git a/test/lib/completions/radvdump.exp b/test/lib/completions/radvdump.exp new file mode 100644 index 00000000..ad1363fd --- /dev/null +++ b/test/lib/completions/radvdump.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "radvdump -" +sync_after_int + + +teardown diff --git a/test/lib/completions/resolvconf.exp b/test/lib/completions/resolvconf.exp new file mode 100644 index 00000000..d1eaf246 --- /dev/null +++ b/test/lib/completions/resolvconf.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "resolvconf -" +sync_after_int + + +teardown diff --git a/test/lib/completions/rfkill.exp b/test/lib/completions/rfkill.exp new file mode 100644 index 00000000..ab0f1811 --- /dev/null +++ b/test/lib/completions/rfkill.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "rfkill " +sync_after_int + +assert_complete_any "rfkill -" +sync_after_int + + +teardown diff --git a/test/lib/completions/rrdtool.exp b/test/lib/completions/rrdtool.exp new file mode 100644 index 00000000..3fb392e4 --- /dev/null +++ b/test/lib/completions/rrdtool.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "rrdtool " +sync_after_int + + +teardown diff --git a/test/lib/completions/runuser.exp b/test/lib/completions/runuser.exp new file mode 100644 index 00000000..051abe1d --- /dev/null +++ b/test/lib/completions/runuser.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "runuser " +sync_after_int + + +teardown diff --git a/test/lib/completions/screen.exp b/test/lib/completions/screen.exp index f37d5f5f..a5b8c69f 100644 --- a/test/lib/completions/screen.exp +++ b/test/lib/completions/screen.exp @@ -24,7 +24,8 @@ assert_complete_any "screen cat" sync_after_int -assert_complete_any "screen -T " +# Limit number of matches, assume at least vt100 and friends are there +assert_complete_any "screen -T vt" sync_after_int diff --git a/test/lib/completions/ss.exp b/test/lib/completions/ss.exp index f6e711c6..e64e33d9 100644 --- a/test/lib/completions/ss.exp +++ b/test/lib/completions/ss.exp @@ -17,5 +17,8 @@ sync_after_int assert_complete_any "ss -A " sync_after_int +assert_complete_any "ss -A foo," +sync_after_int + teardown diff --git a/test/lib/completions/sshfs.exp b/test/lib/completions/sshfs.exp new file mode 100644 index 00000000..42adbd8b --- /dev/null +++ b/test/lib/completions/sshfs.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified { + /_scp_path_esc=/d + } +} + + +setup + + +assert_complete_any "sshfs ./" +sync_after_int + + +teardown diff --git a/test/lib/completions/tox.exp b/test/lib/completions/tox.exp new file mode 100644 index 00000000..55106326 --- /dev/null +++ b/test/lib/completions/tox.exp @@ -0,0 +1,24 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "tox -" +sync_after_int + +assert_complete "ALL" "tox -e " +sync_after_int + +assert_complete "ALL" "tox -e foo," +sync_after_int + + +teardown diff --git a/test/lib/completions/tshark.exp b/test/lib/completions/tshark.exp index f2419119..9e7d9d31 100644 --- a/test/lib/completions/tshark.exp +++ b/test/lib/completions/tshark.exp @@ -17,5 +17,8 @@ sync_after_int assert_complete_any "tshark -G " sync_after_int +assert_complete_any "tshark -O foo,htt" +sync_after_int + teardown diff --git a/test/lib/completions/uscan.exp b/test/lib/completions/uscan.exp new file mode 100644 index 00000000..f96ee971 --- /dev/null +++ b/test/lib/completions/uscan.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "uscan -" +sync_after_int + + +teardown diff --git a/test/lib/completions/useradd.exp b/test/lib/completions/useradd.exp new file mode 100644 index 00000000..c4f4957e --- /dev/null +++ b/test/lib/completions/useradd.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_no_complete "useradd " +sync_after_int + +assert_complete_any "useradd -" +sync_after_int + + +teardown diff --git a/test/lib/completions/userdel.exp b/test/lib/completions/userdel.exp new file mode 100644 index 00000000..2a46246c --- /dev/null +++ b/test/lib/completions/userdel.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +# "r": root +assert_complete_any "userdel r" +sync_after_int + +assert_complete_any "userdel -" +sync_after_int + + +teardown diff --git a/test/lib/completions/usermod.exp b/test/lib/completions/usermod.exp new file mode 100644 index 00000000..d7daf992 --- /dev/null +++ b/test/lib/completions/usermod.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "usermod " +sync_after_int + +assert_complete_any "usermod -" +sync_after_int + + +teardown diff --git a/test/lib/completions/wodim.exp b/test/lib/completions/wodim.exp new file mode 100644 index 00000000..55f63c30 --- /dev/null +++ b/test/lib/completions/wodim.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "wodim " +sync_after_int + + +teardown diff --git a/test/lib/completions/write.exp b/test/lib/completions/write.exp new file mode 100644 index 00000000..4503f6cc --- /dev/null +++ b/test/lib/completions/write.exp @@ -0,0 +1,19 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +# "r": root +assert_complete_any "write r" +sync_after_int + + +teardown diff --git a/test/lib/completions/xdg-mime.exp b/test/lib/completions/xdg-mime.exp new file mode 100644 index 00000000..015c586e --- /dev/null +++ b/test/lib/completions/xdg-mime.exp @@ -0,0 +1,39 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "xdg-mime " +sync_after_int + +assert_complete_any "xdg-mime -" +sync_after_int + +assert_complete_any "xdg-mime query " +sync_after_int + +assert_complete_any "xdg-mime query filetype " +sync_after_int + +assert_complete_any "xdg-mime query default " +sync_after_int + +assert_complete_any "xdg-mime default foo.desktop " +sync_after_int + +assert_complete_any "xdg-mime install --mode " +sync_after_int + +assert_complete_any "xdg-mime uninstall " +sync_after_int + + +teardown diff --git a/test/lib/completions/xdg-settings.exp b/test/lib/completions/xdg-settings.exp new file mode 100644 index 00000000..99a5838d --- /dev/null +++ b/test/lib/completions/xdg-settings.exp @@ -0,0 +1,24 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "xdg-settings " +sync_after_int + +assert_complete_any "xdg-settings --" +sync_after_int + +assert_complete_any "xdg-settings get " +sync_after_int + + +teardown diff --git a/test/lib/completions/xm.exp b/test/lib/completions/xm.exp new file mode 100644 index 00000000..5a0c58e0 --- /dev/null +++ b/test/lib/completions/xm.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "xm " +sync_after_int + + +teardown diff --git a/test/lib/completions/xz.exp b/test/lib/completions/xz.exp index 6e6b29ca..ba9ccd3a 100644 --- a/test/lib/completions/xz.exp +++ b/test/lib/completions/xz.exp @@ -30,4 +30,8 @@ assert_complete_dir "a/ bashcomp.tar" "xz " $::srcdir/fixtures/xz sync_after_int +assert_complete_homedir "xz" +sync_after_int + + teardown diff --git a/test/lib/completions/zopfli.exp b/test/lib/completions/zopfli.exp index 15738ff0..8e17e92b 100644 --- a/test/lib/completions/zopfli.exp +++ b/test/lib/completions/zopfli.exp @@ -15,4 +15,8 @@ assert_complete_any "zopfli " sync_after_int +assert_complete_homedir "zopfli" +sync_after_int + + teardown |