diff options
Diffstat (limited to 'test/lib')
387 files changed, 1988 insertions, 1164 deletions
diff --git a/test/lib/completion.exp b/test/lib/completion.exp index ea2a3d8d..88e92d50 100644 --- a/test/lib/completion.exp +++ b/test/lib/completion.exp @@ -1,4 +1,4 @@ -source ${srcdir}/lib/library.exp +source $::srcdir/lib/library.exp proc completion_exit {} { @@ -6,6 +6,14 @@ proc completion_exit {} { } +proc completion_init {test_file_name} { + # Call completion_start() only once + if {! [info exists ::BASH_VERSINFO]} { + completion_start + } +} + + proc completion_start {} { start_interactive_test } diff --git a/test/lib/completions/a2ps.exp b/test/lib/completions/a2ps.exp index 796e14cc..77cd07f5 100644 --- a/test/lib/completions/a2ps.exp +++ b/test/lib/completions/a2ps.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/abook.exp b/test/lib/completions/abook.exp index 3f4e301f..43f62729 100644 --- a/test/lib/completions/abook.exp +++ b/test/lib/completions/abook.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/aclocal.exp b/test/lib/completions/aclocal.exp new file mode 100644 index 00000000..da133aa8 --- /dev/null +++ b/test/lib/completions/aclocal.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "aclocal " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/acroread.exp b/test/lib/completions/acroread.exp index 4f11f905..f627d34e 100644 --- a/test/lib/completions/acroread.exp +++ b/test/lib/completions/acroread.exp @@ -1,19 +1,17 @@ proc setup {} { save_env - assert_bash_exec "touch fixtures/shared/default/t.pdf"; # Create temporary files -}; # setup() +} proc teardown {} { - assert_bash_exec "rm fixtures/shared/default/t.pdf"; # Remove temporary files - assert_env_unmodified -}; # teardown() + assert_env_unmodified {/OLDPWD/d} +} setup -assert_complete {"bar bar.d/" foo.d/ t.pdf} "acroread fixtures/shared/default/" +assert_complete_dir {foo.d/ t.pdf} "acroread " $::srcdir/fixtures/acroread sync_after_int diff --git a/test/lib/completions/add_members.exp b/test/lib/completions/add_members.exp index 02cd762d..46c7a688 100644 --- a/test/lib/completions/add_members.exp +++ b/test/lib/completions/add_members.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/alias.exp b/test/lib/completions/alias.exp index e6b88d00..9dba4e62 100644 --- a/test/lib/completions/alias.exp +++ b/test/lib/completions/alias.exp @@ -3,13 +3,13 @@ proc setup {} { assert_bash_exec "alias foo=bar" assert_bash_exec "alias bar='foo foo'" save_env -}; # setup() +} proc teardown {} { assert_bash_exec "unalias -a"; # Remove all aliases assert_env_unmodified -}; # teardown() +} setup @@ -34,7 +34,7 @@ expect { -re "^alias foo\b\b\bfoo=foo\b\b\b$" { fail "$test: Wrong cursor position" } -re /@ { unresolved "$test" } default { unresolved "$test" } -}; # expect +} sync_after_int diff --git a/test/lib/completions/animate.exp b/test/lib/completions/animate.exp index 26065d25..12314d79 100644 --- a/test/lib/completions/animate.exp +++ b/test/lib/completions/animate.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/ant.exp b/test/lib/completions/ant.exp index 81294439..de57f24a 100644 --- a/test/lib/completions/ant.exp +++ b/test/lib/completions/ant.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/apache2ctl.exp b/test/lib/completions/apache2ctl.exp index e63abb16..88e53fc2 100644 --- a/test/lib/completions/apache2ctl.exp +++ b/test/lib/completions/apache2ctl.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/apt-build.exp b/test/lib/completions/apt-build.exp index fd09d0eb..01ff04b4 100644 --- a/test/lib/completions/apt-build.exp +++ b/test/lib/completions/apt-build.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/apt-cache.exp b/test/lib/completions/apt-cache.exp index 5336beab..63be48a8 100644 --- a/test/lib/completions/apt-cache.exp +++ b/test/lib/completions/apt-cache.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/apt-get.exp b/test/lib/completions/apt-get.exp index 6bd0f3a2..66887bd0 100644 --- a/test/lib/completions/apt-get.exp +++ b/test/lib/completions/apt-get.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/aptitude.exp b/test/lib/completions/aptitude.exp index dde6d26e..e6e82abb 100644 --- a/test/lib/completions/aptitude.exp +++ b/test/lib/completions/aptitude.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/arch.exp b/test/lib/completions/arch.exp index 9f7114c4..0550c76b 100644 --- a/test/lib/completions/arch.exp +++ b/test/lib/completions/arch.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/arpspoof.exp b/test/lib/completions/arpspoof.exp index 7db79f50..91ef5182 100644 --- a/test/lib/completions/arpspoof.exp +++ b/test/lib/completions/arpspoof.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/aspell.exp b/test/lib/completions/aspell.exp index 4edeb03b..9dd5f61a 100644 --- a/test/lib/completions/aspell.exp +++ b/test/lib/completions/aspell.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/autoconf.exp b/test/lib/completions/autoconf.exp index 4a44b651..53b096db 100644 --- a/test/lib/completions/autoconf.exp +++ b/test/lib/completions/autoconf.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/autoheader.exp b/test/lib/completions/autoheader.exp new file mode 100644 index 00000000..d85d4606 --- /dev/null +++ b/test/lib/completions/autoheader.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "autoheader " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/automake.exp b/test/lib/completions/automake.exp index cf27364a..f875da56 100644 --- a/test/lib/completions/automake.exp +++ b/test/lib/completions/automake.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/autoreconf.exp b/test/lib/completions/autoreconf.exp new file mode 100644 index 00000000..98808fb2 --- /dev/null +++ b/test/lib/completions/autoreconf.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "autoreconf " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/autorpm.exp b/test/lib/completions/autorpm.exp index 99b743ca..2ae4ff80 100644 --- a/test/lib/completions/autorpm.exp +++ b/test/lib/completions/autorpm.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/autoscan.exp b/test/lib/completions/autoscan.exp new file mode 100644 index 00000000..f75da812 --- /dev/null +++ b/test/lib/completions/autoscan.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "autoscan " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/autoupdate.exp b/test/lib/completions/autoupdate.exp new file mode 100644 index 00000000..c83912dd --- /dev/null +++ b/test/lib/completions/autoupdate.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "autoupdate " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/awk.exp b/test/lib/completions/awk.exp index 4288adbf..260dabcc 100644 --- a/test/lib/completions/awk.exp +++ b/test/lib/completions/awk.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/badblocks.exp b/test/lib/completions/badblocks.exp new file mode 100644 index 00000000..d453b5bd --- /dev/null +++ b/test/lib/completions/badblocks.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "badblocks " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/bash.exp b/test/lib/completions/bash.exp index 4caf58fc..bf01e76d 100644 --- a/test/lib/completions/bash.exp +++ b/test/lib/completions/bash.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/bc.exp b/test/lib/completions/bc.exp index c437d037..23c22b62 100644 --- a/test/lib/completions/bc.exp +++ b/test/lib/completions/bc.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/bison.exp b/test/lib/completions/bison.exp index a3dea1e0..4bbb59fa 100644 --- a/test/lib/completions/bison.exp +++ b/test/lib/completions/bison.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/bk.exp b/test/lib/completions/bk.exp index 4915136e..b652e6b0 100644 --- a/test/lib/completions/bk.exp +++ b/test/lib/completions/bk.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/brctl.exp b/test/lib/completions/brctl.exp index d87002a2..57c9edff 100644 --- a/test/lib/completions/brctl.exp +++ b/test/lib/completions/brctl.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/btdownloadcurses.py.exp b/test/lib/completions/btdownloadcurses.py.exp index 9dc0ba5a..71a00de7 100644 --- a/test/lib/completions/btdownloadcurses.py.exp +++ b/test/lib/completions/btdownloadcurses.py.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/btdownloadgui.py.exp b/test/lib/completions/btdownloadgui.py.exp index 03897a53..65f56776 100644 --- a/test/lib/completions/btdownloadgui.py.exp +++ b/test/lib/completions/btdownloadgui.py.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/btdownloadheadless.py.exp b/test/lib/completions/btdownloadheadless.py.exp index 69c62950..3c833bb8 100644 --- a/test/lib/completions/btdownloadheadless.py.exp +++ b/test/lib/completions/btdownloadheadless.py.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/bzip2.exp b/test/lib/completions/bzip2.exp index e5389a2a..2813dd0e 100644 --- a/test/lib/completions/bzip2.exp +++ b/test/lib/completions/bzip2.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/c++.exp b/test/lib/completions/c++.exp index 1fe4bb13..4dffb042 100644 --- a/test/lib/completions/c++.exp +++ b/test/lib/completions/c++.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/cancel.exp b/test/lib/completions/cancel.exp index 24ca47c4..f4a03473 100644 --- a/test/lib/completions/cancel.exp +++ b/test/lib/completions/cancel.exp @@ -1,18 +1,18 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup # Adding a print job is successful? -if {[assert_exec {lp -H hold fixtures/shared/default/foo} job "" "untested"]} { +if {[assert_exec {lp -H hold $::srcdir/fixtures/shared/default/foo} job "" "untested"]} { # Yes, adding a print-job is successful; # Retrieve job-id, so we can cancel the job after the test set job_id [lindex [split $job] 3] @@ -22,7 +22,7 @@ if {[assert_exec {lp -H hold fixtures/shared/default/foo} job "" "untested"]} { assert_complete $jobs "cancel " # Remove/cancel the test print job assert_exec "cancel $job_id" -}; # if +} sync_after_int diff --git a/test/lib/completions/cardctl.exp b/test/lib/completions/cardctl.exp index b5d7e88d..9df90f48 100644 --- a/test/lib/completions/cardctl.exp +++ b/test/lib/completions/cardctl.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/cat.exp b/test/lib/completions/cat.exp index 46e8775f..01b3659e 100644 --- a/test/lib/completions/cat.exp +++ b/test/lib/completions/cat.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/cc.exp b/test/lib/completions/cc.exp index 1d63d006..eb722dea 100644 --- a/test/lib/completions/cc.exp +++ b/test/lib/completions/cc.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/cd.exp b/test/lib/completions/cd.exp index 58233575..55bae158 100644 --- a/test/lib/completions/cd.exp +++ b/test/lib/completions/cd.exp @@ -1,18 +1,18 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup set test "Tab should complete" -assert_complete {"bar bar.d/" foo.d/} "cd fixtures/shared/default/" $test +assert_complete {"bar bar.d/" foo.d/} "cd $::srcdir/fixtures/shared/default/" $test sync_after_int @@ -20,16 +20,16 @@ sync_after_int set test "Tab should complete cd at cursor position" # Try completion -set cmd "cd fixtures/shared/default/foo" +set cmd "cd $::srcdir/fixtures/shared/default/foo" append cmd \002\002\002; # \002 = ^B = Move cursor left in bash emacs mode #append cmd \033\0133D; # Escape-[-D = Cursor left send "$cmd\t" expect { - -re "cd fixtures/shared/default/foo\b\b\b\r\n(\.svn/ +|)bar bar.d/ +foo.d/ *(\.svn/ *|)\r\n/@cd fixtures/shared/default/foo\b\b\b$" { pass "$test" } - -re "^cd fixtures/shared/default/foo\b\b\bfoo.d/foo\b\b\b$" { fail "$test: Wrong cursor position" } + -re "cd $::srcdir/fixtures/shared/default/foo\b\b\b\r\n(\.svn/ +|)bar bar.d/ +foo.d/ *(\.svn/ *|)\r\n/@cd $::srcdir/fixtures/shared/default/foo\b\b\b$" { pass "$test" } + -re "^cd $::srcdir/fixtures/shared/default/foo\b\b\bfoo.d/foo\b\b\b$" { fail "$test: Wrong cursor position" } -re /@ { unresolved "$test at prompt" } default { unresolved "$test" } -}; # expect +} sync_after_int @@ -37,11 +37,13 @@ sync_after_int set test "Tab should complete CDPATH" # Set CDPATH +assert_bash_exec "declare -p CDPATH &>/dev/null && OLDCDPATH=\$CDPATH || :" assert_bash_exec "CDPATH=\$PWD"; -assert_complete "fixtures/shared/default/foo.d/" "cd fixtures/shared/default/fo" $test +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" +assert_bash_exec "declare -p OLDCDPATH &>/dev/null && CDPATH=\$OLDCDPATH || unset CDPATH && unset OLDCDPATH" teardown diff --git a/test/lib/completions/cdrecord.exp b/test/lib/completions/cdrecord.exp index d369f79d..192d2ded 100644 --- a/test/lib/completions/cdrecord.exp +++ b/test/lib/completions/cdrecord.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/change_pw.exp b/test/lib/completions/change_pw.exp index ca9bcdbd..28301941 100644 --- a/test/lib/completions/change_pw.exp +++ b/test/lib/completions/change_pw.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/check_db.exp b/test/lib/completions/check_db.exp index ca59a715..fe34ead2 100644 --- a/test/lib/completions/check_db.exp +++ b/test/lib/completions/check_db.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/check_perms.exp b/test/lib/completions/check_perms.exp index a58995b0..b40b78fc 100644 --- a/test/lib/completions/check_perms.exp +++ b/test/lib/completions/check_perms.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/chgrp.exp b/test/lib/completions/chgrp.exp index 8dfeea79..e9238bde 100644 --- a/test/lib/completions/chgrp.exp +++ b/test/lib/completions/chgrp.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/chkconfig.exp b/test/lib/completions/chkconfig.exp index e7469b34..dae3b3bd 100644 --- a/test/lib/completions/chkconfig.exp +++ b/test/lib/completions/chkconfig.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/chown.exp b/test/lib/completions/chown.exp index 953b2b02..bc1a8c7f 100644 --- a/test/lib/completions/chown.exp +++ b/test/lib/completions/chown.exp @@ -1,10 +1,12 @@ proc setup {} { + # fake root command to get all users/groups completed at least for now + assert_bash_exec {root_command=sudo} save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -38,12 +40,11 @@ if {!$failed_find_unique_completion} { assert_complete $fulluser:$fullgroup "chown $fulluser:$partgroup" sync_after_int - # One slash should work correctly (doubled here for tcl). - assert_complete $fulluser\\:$fullgroup "chown $fulluser\\:$partgroup" + assert_complete "dot.user:$fullgroup" "chown dot.user:$partgroup" sync_after_int foreach prefix { - "funky\\ user:" "funky\\ user\\:" "funky.user:" "funky\\.user:" "fu\\ nky.user\\:" + "funky\\ user:" "funky.user:" "funky\\.user:" "fu\\ nky.user:" "f\\ o\\ o\\.\\bar:" "foo\\_b\\ a\\.r\\ :" } { set test "Check preserve special chars in $prefix$partgroup<TAB>" diff --git a/test/lib/completions/chsh.exp b/test/lib/completions/chsh.exp index 99262a2c..a26ac93f 100644 --- a/test/lib/completions/chsh.exp +++ b/test/lib/completions/chsh.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/ci.exp b/test/lib/completions/ci.exp index 09105eec..15ef2ecc 100644 --- a/test/lib/completions/ci.exp +++ b/test/lib/completions/ci.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/civclient.exp b/test/lib/completions/civclient.exp index 8159c2bc..c0047468 100644 --- a/test/lib/completions/civclient.exp +++ b/test/lib/completions/civclient.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/civserver.exp b/test/lib/completions/civserver.exp index df459688..3739f50e 100644 --- a/test/lib/completions/civserver.exp +++ b/test/lib/completions/civserver.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/cksfv.exp b/test/lib/completions/cksfv.exp index a40a5023..2b9be04c 100644 --- a/test/lib/completions/cksfv.exp +++ b/test/lib/completions/cksfv.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/cleanarch.exp b/test/lib/completions/cleanarch.exp index e3145e81..a5f3bfe6 100644 --- a/test/lib/completions/cleanarch.exp +++ b/test/lib/completions/cleanarch.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/clisp.exp b/test/lib/completions/clisp.exp index 2bc599ac..dfbad4f3 100644 --- a/test/lib/completions/clisp.exp +++ b/test/lib/completions/clisp.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/clone_member.exp b/test/lib/completions/clone_member.exp index 34b4db57..d83d73bc 100644 --- a/test/lib/completions/clone_member.exp +++ b/test/lib/completions/clone_member.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/co.exp b/test/lib/completions/co.exp index 49fe3a64..215268b6 100644 --- a/test/lib/completions/co.exp +++ b/test/lib/completions/co.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/composite.exp b/test/lib/completions/composite.exp index e39ce72f..aba9af3b 100644 --- a/test/lib/completions/composite.exp +++ b/test/lib/completions/composite.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/config_list.exp b/test/lib/completions/config_list.exp index 5246c860..27699239 100644 --- a/test/lib/completions/config_list.exp +++ b/test/lib/completions/config_list.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/configure.exp b/test/lib/completions/configure.exp index 74afba1b..b4399cb1 100644 --- a/test/lib/completions/configure.exp +++ b/test/lib/completions/configure.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/convert.exp b/test/lib/completions/convert.exp index d8a77e35..07032040 100644 --- a/test/lib/completions/convert.exp +++ b/test/lib/completions/convert.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/cowsay.exp b/test/lib/completions/cowsay.exp index dfbefe1a..382f400f 100644 --- a/test/lib/completions/cowsay.exp +++ b/test/lib/completions/cowsay.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/cp.exp b/test/lib/completions/cp.exp index 9fe46537..703bf263 100644 --- a/test/lib/completions/cp.exp +++ b/test/lib/completions/cp.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/cpio.exp b/test/lib/completions/cpio.exp index b02f2719..93f6f3c1 100644 --- a/test/lib/completions/cpio.exp +++ b/test/lib/completions/cpio.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/createdb.exp b/test/lib/completions/createdb.exp index 1e5cdbe7..aafff1b6 100644 --- a/test/lib/completions/createdb.exp +++ b/test/lib/completions/createdb.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/crontab.exp b/test/lib/completions/crontab.exp new file mode 100644 index 00000000..18e2269f --- /dev/null +++ b/test/lib/completions/crontab.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "crontab " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/cryptsetup.exp b/test/lib/completions/cryptsetup.exp index e94c3ac1..4c20bc5d 100644 --- a/test/lib/completions/cryptsetup.exp +++ b/test/lib/completions/cryptsetup.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/csplit.exp b/test/lib/completions/csplit.exp index 3a66a627..87b89dea 100644 --- a/test/lib/completions/csplit.exp +++ b/test/lib/completions/csplit.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/cut.exp b/test/lib/completions/cut.exp index b9bcf6c5..edb558ea 100644 --- a/test/lib/completions/cut.exp +++ b/test/lib/completions/cut.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/cvs.exp b/test/lib/completions/cvs.exp index 2a26da8e..3b2643d3 100644 --- a/test/lib/completions/cvs.exp +++ b/test/lib/completions/cvs.exp @@ -1,7 +1,7 @@ proc setup {} { save_env - assert_bash_exec {OLDHOME=$HOME ; HOME=$TESTDIR/fixtures/cvs} -}; # setup() + assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIR/fixtures/cvs} +} proc teardown {} { @@ -9,7 +9,7 @@ proc teardown {} { assert_env_unmodified { /OLDHOME=/d } -}; # teardown() +} setup @@ -27,7 +27,7 @@ send "$cmd\t" expect { -re "^$cmd\r\n.*:pserver:.*\r\n/@$cmd:pserver:.*$" { pass "$test" } default { fail "$test" } -}; # expect +} sync_after_int diff --git a/test/lib/completions/cvsps.exp b/test/lib/completions/cvsps.exp index 1fd4a0a9..6cf95ac1 100644 --- a/test/lib/completions/cvsps.exp +++ b/test/lib/completions/cvsps.exp @@ -1,7 +1,7 @@ proc setup {} { save_env - assert_bash_exec {OLDHOME=$HOME ; HOME=$TESTDIR/fixtures/cvs} -}; # setup() + assert_bash_exec {OLDHOME=$HOME ; HOME=$SRCDIR/fixtures/cvs} +} proc teardown {} { @@ -9,7 +9,7 @@ proc teardown {} { assert_env_unmodified { /OLDHOME=/d } -}; # teardown() +} setup @@ -27,7 +27,7 @@ send "$cmd\t" expect { -re "^$cmd\r\n.*:pserver:.*\r\n/@$cmd:pserver:.*$" { pass "$test" } default { fail "$test" } -}; # expect +} sync_after_int diff --git a/test/lib/completions/date.exp b/test/lib/completions/date.exp index 9d75f5f3..ee970cf7 100644 --- a/test/lib/completions/date.exp +++ b/test/lib/completions/date.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/dcop.exp b/test/lib/completions/dcop.exp index 6ed800c5..1e27346b 100644 --- a/test/lib/completions/dcop.exp +++ b/test/lib/completions/dcop.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {dcop} words]} { assert_complete $words "dcop " -}; # if +} sync_after_int diff --git a/test/lib/completions/dd.exp b/test/lib/completions/dd.exp index 400dd143..e02e037c 100644 --- a/test/lib/completions/dd.exp +++ b/test/lib/completions/dd.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -24,7 +24,7 @@ expect -ex "$cmd" expect { -re "^=$" { pass $test } -re {^\\=$} { xfail $test } -}; # expect +} sync_after_int diff --git a/test/lib/completions/df.exp b/test/lib/completions/df.exp index 487d70a9..acf212a9 100644 --- a/test/lib/completions/df.exp +++ b/test/lib/completions/df.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/dhclient.exp b/test/lib/completions/dhclient.exp index 42c14c82..6caff5fc 100644 --- a/test/lib/completions/dhclient.exp +++ b/test/lib/completions/dhclient.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/dict.exp b/test/lib/completions/dict.exp index 32fb4988..402e0c5c 100644 --- a/test/lib/completions/dict.exp +++ b/test/lib/completions/dict.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/diff.exp b/test/lib/completions/diff.exp index c009f640..918bf7fd 100644 --- a/test/lib/completions/diff.exp +++ b/test/lib/completions/diff.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/dir.exp b/test/lib/completions/dir.exp index 6e20d37d..c9f61cd5 100644 --- a/test/lib/completions/dir.exp +++ b/test/lib/completions/dir.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/display.exp b/test/lib/completions/display.exp index 9a9d6901..e9fe766a 100644 --- a/test/lib/completions/display.exp +++ b/test/lib/completions/display.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/dnsspoof.exp b/test/lib/completions/dnsspoof.exp index 3223a349..4aefb956 100644 --- a/test/lib/completions/dnsspoof.exp +++ b/test/lib/completions/dnsspoof.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/dpkg-deb.exp b/test/lib/completions/dpkg-deb.exp index c8656610..37ece08d 100644 --- a/test/lib/completions/dpkg-deb.exp +++ b/test/lib/completions/dpkg-deb.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/dpkg-reconfigure.exp b/test/lib/completions/dpkg-reconfigure.exp index 267594be..0212666b 100644 --- a/test/lib/completions/dpkg-reconfigure.exp +++ b/test/lib/completions/dpkg-reconfigure.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/dpkg-source.exp b/test/lib/completions/dpkg-source.exp index a21eff45..a42759b9 100644 --- a/test/lib/completions/dpkg-source.exp +++ b/test/lib/completions/dpkg-source.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/dpkg.exp b/test/lib/completions/dpkg.exp index 2bd1fb6e..f358e172 100644 --- a/test/lib/completions/dpkg.exp +++ b/test/lib/completions/dpkg.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -20,7 +20,7 @@ sync_after_int # Build list of installed packages if {[assert_exec {dpkg --get-selections | command grep \[\[:space:\]\]install$ | cut -f1} packages]} { assert_complete $packages "dpkg -L " -}; # if +} sync_after_int diff --git a/test/lib/completions/dropdb.exp b/test/lib/completions/dropdb.exp index e78a2ba7..8f2d5bfb 100644 --- a/test/lib/completions/dropdb.exp +++ b/test/lib/completions/dropdb.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/dselect.exp b/test/lib/completions/dselect.exp index f6257294..634db05e 100644 --- a/test/lib/completions/dselect.exp +++ b/test/lib/completions/dselect.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/dsniff.exp b/test/lib/completions/dsniff.exp index a0cc43ac..cb8912b6 100644 --- a/test/lib/completions/dsniff.exp +++ b/test/lib/completions/dsniff.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/du.exp b/test/lib/completions/du.exp index d1ffa8ca..6ddeb9b2 100644 --- a/test/lib/completions/du.exp +++ b/test/lib/completions/du.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/dumpdb.exp b/test/lib/completions/dumpdb.exp index 240214b3..5b617b11 100644 --- a/test/lib/completions/dumpdb.exp +++ b/test/lib/completions/dumpdb.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/dumpe2fs.exp b/test/lib/completions/dumpe2fs.exp new file mode 100644 index 00000000..e935c504 --- /dev/null +++ b/test/lib/completions/dumpe2fs.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "dumpe2fs " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/e2freefrag.exp b/test/lib/completions/e2freefrag.exp new file mode 100644 index 00000000..1530c9c9 --- /dev/null +++ b/test/lib/completions/e2freefrag.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "e2freefrag " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/e2label.exp b/test/lib/completions/e2label.exp new file mode 100644 index 00000000..8ae7f443 --- /dev/null +++ b/test/lib/completions/e2label.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "e2label " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/enscript.exp b/test/lib/completions/enscript.exp index 7fefabdd..c859b50f 100644 --- a/test/lib/completions/enscript.exp +++ b/test/lib/completions/enscript.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/env.exp b/test/lib/completions/env.exp index f03f5395..4f213748 100644 --- a/test/lib/completions/env.exp +++ b/test/lib/completions/env.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {env --help} "" "" "unsupported"]} { assert_complete_any "env --" -}; # if +} sync_after_int diff --git a/test/lib/completions/ether-wake.exp b/test/lib/completions/ether-wake.exp new file mode 100644 index 00000000..fe1aa174 --- /dev/null +++ b/test/lib/completions/ether-wake.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "ether-wake " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/evince.exp b/test/lib/completions/evince.exp index 22279a26..204467a1 100644 --- a/test/lib/completions/evince.exp +++ b/test/lib/completions/evince.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified {/OLDPWD=/d} -}; # teardown() +} setup @@ -26,7 +26,7 @@ set files { .tga .TGA .tif .TIF .tiff .TIFF .xpm .XPM .xwd .XWD } -assert_complete_dir $files "evince " "fixtures/evince" +assert_complete_dir $files "evince " "$::srcdir/fixtures/evince" sync_after_int diff --git a/test/lib/completions/expand.exp b/test/lib/completions/expand.exp index d5cd6b17..76b6eafa 100644 --- a/test/lib/completions/expand.exp +++ b/test/lib/completions/expand.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {expand --help} "" "" "unsupported"]} { assert_complete_any "expand --" -}; # if +} sync_after_int diff --git a/test/lib/completions/filefrag.exp b/test/lib/completions/filefrag.exp new file mode 100644 index 00000000..fa80cd05 --- /dev/null +++ b/test/lib/completions/filefrag.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "filefrag " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/filesnarf.exp b/test/lib/completions/filesnarf.exp index 53cf01e4..03755056 100644 --- a/test/lib/completions/filesnarf.exp +++ b/test/lib/completions/filesnarf.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/find.exp b/test/lib/completions/find.exp index 4b1728dc..9acda648 100644 --- a/test/lib/completions/find.exp +++ b/test/lib/completions/find.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified {/OLDPWD=/d} -}; # teardown() +} setup @@ -41,7 +41,7 @@ sync_after_int set test "-wholename should complete files/dirs" -set dir fixtures/shared/default +set dir $::srcdir/fixtures/shared/default set files [split [exec bash -c "cd $dir && ls -p"] "\n"] assert_complete_dir $files "find -wholename " $dir @@ -50,28 +50,26 @@ sync_after_int set test "-uid should complete uids" - # Complete set cmd "find -uid " send "$cmd\t" expect { -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" } -re /@ { unresolved "$test at prompt" } -re eof { unresolved "eof" } -}; # expect +} sync_after_int set test "-gid should complete gids" - # Complete set cmd "find -gid " send "$cmd\t" expect { -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" } -re /@ { unresolved "$test at prompt" } -re eof { unresolved "eof" } -}; # expect +} sync_after_int diff --git a/test/lib/completions/find_member.exp b/test/lib/completions/find_member.exp index 58fac7d2..55672091 100644 --- a/test/lib/completions/find_member.exp +++ b/test/lib/completions/find_member.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/finger.exp b/test/lib/completions/finger.exp index 30f2b080..70e3ed2c 100644 --- a/test/lib/completions/finger.exp +++ b/test/lib/completions/finger.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -16,7 +16,7 @@ set test "Tab should complete usernames" set users {} foreach u [exec bash -c "compgen -A user"] { lappend users $u -}; # foreach +} 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" +assert_complete_partial [exec bash -c "compgen -A user"] "finger" -nospace sync_after_int @@ -39,15 +39,15 @@ 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 == "" && [string first $first $::COMP_WORDBREAKS] == -1} {set char $first} if {$char != ""} { # Only append unique hostnames starting with $char if {$first == $char && [lsearch -exact $hosts "test@$h"] == -1} { # Prefix hosts with username 'test@' lappend hosts "test@$h" - }; # if - }; # if -}; # foreach + } + } +} assert_complete $hosts "finger test@$char" $test diff --git a/test/lib/completions/fmt.exp b/test/lib/completions/fmt.exp index 28570682..7d3cc17f 100644 --- a/test/lib/completions/fmt.exp +++ b/test/lib/completions/fmt.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {fmt --help} "" "" "unsupported"]} { assert_complete_any "fmt -" -}; # if +} sync_after_int diff --git a/test/lib/completions/fold.exp b/test/lib/completions/fold.exp index a5230b03..f447f08b 100644 --- a/test/lib/completions/fold.exp +++ b/test/lib/completions/fold.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {fold --help} "" "" "unsupported"]} { assert_complete_any "fold --" -}; # if +} sync_after_int diff --git a/test/lib/completions/freerdp.exp b/test/lib/completions/freerdp.exp new file mode 100644 index 00000000..be61d459 --- /dev/null +++ b/test/lib/completions/freerdp.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "xfreerdp" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/g++.exp b/test/lib/completions/g++.exp index 4dc2591a..4dbe73f4 100644 --- a/test/lib/completions/g++.exp +++ b/test/lib/completions/g++.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/g4.exp b/test/lib/completions/g4.exp index 203de061..7d575f10 100644 --- a/test/lib/completions/g4.exp +++ b/test/lib/completions/g4.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/g77.exp b/test/lib/completions/g77.exp index 8802aca9..e23745b7 100644 --- a/test/lib/completions/g77.exp +++ b/test/lib/completions/g77.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/gcc.exp b/test/lib/completions/gcc.exp index 8e52a120..00097cc2 100644 --- a/test/lib/completions/gcc.exp +++ b/test/lib/completions/gcc.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/gcj.exp b/test/lib/completions/gcj.exp index db52d59a..cde07700 100644 --- a/test/lib/completions/gcj.exp +++ b/test/lib/completions/gcj.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/gcl.exp b/test/lib/completions/gcl.exp index 7cead846..1846d0d1 100644 --- a/test/lib/completions/gcl.exp +++ b/test/lib/completions/gcl.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/gdb.exp b/test/lib/completions/gdb.exp index 982f0878..2e389edb 100644 --- a/test/lib/completions/gdb.exp +++ b/test/lib/completions/gdb.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/genaliases.exp b/test/lib/completions/genaliases.exp index 064eb386..bb4d5e0e 100644 --- a/test/lib/completions/genaliases.exp +++ b/test/lib/completions/genaliases.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/getent.exp b/test/lib/completions/getent.exp index 121f3b38..6500b22d 100644 --- a/test/lib/completions/getent.exp +++ b/test/lib/completions/getent.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/gkrellm.exp b/test/lib/completions/gkrellm.exp index f8b0dd4d..009770fc 100644 --- a/test/lib/completions/gkrellm.exp +++ b/test/lib/completions/gkrellm.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/gmplayer.exp b/test/lib/completions/gmplayer.exp index d9032698..a110cb2f 100644 --- a/test/lib/completions/gmplayer.exp +++ b/test/lib/completions/gmplayer.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/gnatmake.exp b/test/lib/completions/gnatmake.exp index 902aa062..bad4da33 100644 --- a/test/lib/completions/gnatmake.exp +++ b/test/lib/completions/gnatmake.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/gpc.exp b/test/lib/completions/gpc.exp index 6c4d0383..71eddacc 100644 --- a/test/lib/completions/gpc.exp +++ b/test/lib/completions/gpc.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/gperf.exp b/test/lib/completions/gperf.exp index aa24333e..1cf77678 100644 --- a/test/lib/completions/gperf.exp +++ b/test/lib/completions/gperf.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/gpg.exp b/test/lib/completions/gpg.exp index 29fd2244..ea6805fa 100644 --- a/test/lib/completions/gpg.exp +++ b/test/lib/completions/gpg.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/gprof.exp b/test/lib/completions/gprof.exp index 592786af..996a1efd 100644 --- a/test/lib/completions/gprof.exp +++ b/test/lib/completions/gprof.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {gprof --help} "" "" "unsupported"]} { assert_complete_any "gprof --" -}; # if +} sync_after_int diff --git a/test/lib/completions/grep.exp b/test/lib/completions/grep.exp index 3814df71..c94ae727 100644 --- a/test/lib/completions/grep.exp +++ b/test/lib/completions/grep.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/growisofs.exp b/test/lib/completions/growisofs.exp new file mode 100644 index 00000000..0f2a0ec7 --- /dev/null +++ b/test/lib/completions/growisofs.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "growisofs " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/grub.exp b/test/lib/completions/grub.exp index 9578e789..b88d1f26 100644 --- a/test/lib/completions/grub.exp +++ b/test/lib/completions/grub.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/gzip.exp b/test/lib/completions/gzip.exp index f212c61a..32acf428 100644 --- a/test/lib/completions/gzip.exp +++ b/test/lib/completions/gzip.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -19,7 +19,7 @@ expect { -re "^$cmd\r\n.*$cmd$" { pass "$test" } -re /@ { unresolved "$test at prompt" } -re eof { unresolved "eof" } -}; # expect +} sync_after_int diff --git a/test/lib/completions/hcitool.exp b/test/lib/completions/hcitool.exp index 9283adff..e6ae0032 100644 --- a/test/lib/completions/hcitool.exp +++ b/test/lib/completions/hcitool.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/head.exp b/test/lib/completions/head.exp index 0d4f6a20..7edb8a1b 100644 --- a/test/lib/completions/head.exp +++ b/test/lib/completions/head.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {head --help} "" "" "unsupported"]} { assert_complete_any "head --" -}; # if +} sync_after_int diff --git a/test/lib/completions/hping2.exp b/test/lib/completions/hping2.exp new file mode 100644 index 00000000..8919626d --- /dev/null +++ b/test/lib/completions/hping2.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "hping2 " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/iconv.exp b/test/lib/completions/iconv.exp index 420e923c..dcce330f 100644 --- a/test/lib/completions/iconv.exp +++ b/test/lib/completions/iconv.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/id.exp b/test/lib/completions/id.exp index 155af52c..b03ee721 100644 --- a/test/lib/completions/id.exp +++ b/test/lib/completions/id.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/identify.exp b/test/lib/completions/identify.exp index 8f38ae47..3347c5cd 100644 --- a/test/lib/completions/identify.exp +++ b/test/lib/completions/identify.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/ifdown.exp b/test/lib/completions/ifdown.exp index 68225bb9..7849f3f7 100644 --- a/test/lib/completions/ifdown.exp +++ b/test/lib/completions/ifdown.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/iftop.exp b/test/lib/completions/iftop.exp new file mode 100644 index 00000000..12941610 --- /dev/null +++ b/test/lib/completions/iftop.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "iftop " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ifup.exp b/test/lib/completions/ifup.exp index 9d717178..2c1c010e 100644 --- a/test/lib/completions/ifup.exp +++ b/test/lib/completions/ifup.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/indent.exp b/test/lib/completions/indent.exp index e8fc32b1..5c5bb1c7 100644 --- a/test/lib/completions/indent.exp +++ b/test/lib/completions/indent.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/info.exp b/test/lib/completions/info.exp index ed769f1a..e7c79e6e 100644 --- a/test/lib/completions/info.exp +++ b/test/lib/completions/info.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/inject.exp b/test/lib/completions/inject.exp index 7c093146..4f95be23 100644 --- a/test/lib/completions/inject.exp +++ b/test/lib/completions/inject.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/insmod.exp b/test/lib/completions/insmod.exp index 8e83f0b4..a312c894 100644 --- a/test/lib/completions/insmod.exp +++ b/test/lib/completions/insmod.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/invoke-rc.d.exp b/test/lib/completions/invoke-rc.d.exp index 4dc9f1d8..d217d17e 100644 --- a/test/lib/completions/invoke-rc.d.exp +++ b/test/lib/completions/invoke-rc.d.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/ip.exp b/test/lib/completions/ip.exp new file mode 100644 index 00000000..8f45f6a3 --- /dev/null +++ b/test/lib/completions/ip.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "ip " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ipmitool.exp b/test/lib/completions/ipmitool.exp new file mode 100644 index 00000000..aa18e3ff --- /dev/null +++ b/test/lib/completions/ipmitool.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "ipmitool " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ipsec.exp b/test/lib/completions/ipsec.exp index 15617a16..74ef638c 100644 --- a/test/lib/completions/ipsec.exp +++ b/test/lib/completions/ipsec.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/ipv6calc.exp b/test/lib/completions/ipv6calc.exp index 74ce95f7..42201f0c 100644 --- a/test/lib/completions/ipv6calc.exp +++ b/test/lib/completions/ipv6calc.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/irb.exp b/test/lib/completions/irb.exp index 81bea6d2..720edfdf 100644 --- a/test/lib/completions/irb.exp +++ b/test/lib/completions/irb.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/iscsiadm.exp b/test/lib/completions/iscsiadm.exp new file mode 100644 index 00000000..104e7c4e --- /dev/null +++ b/test/lib/completions/iscsiadm.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "iscsiadm --mode " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/isql.exp b/test/lib/completions/isql.exp index 87e16bca..ca40faca 100644 --- a/test/lib/completions/isql.exp +++ b/test/lib/completions/isql.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified {/ODBCINI=/d} -}; # teardown() +} setup diff --git a/test/lib/completions/iwconfig.exp b/test/lib/completions/iwconfig.exp index f09719d7..82ae11f3 100644 --- a/test/lib/completions/iwconfig.exp +++ b/test/lib/completions/iwconfig.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/iwlist.exp b/test/lib/completions/iwlist.exp index 80a2c367..43c919ef 100644 --- a/test/lib/completions/iwlist.exp +++ b/test/lib/completions/iwlist.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/iwpriv.exp b/test/lib/completions/iwpriv.exp index f3102cc5..86b1ee95 100644 --- a/test/lib/completions/iwpriv.exp +++ b/test/lib/completions/iwpriv.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/iwspy.exp b/test/lib/completions/iwspy.exp index 5fa0bee5..2894ca4e 100644 --- a/test/lib/completions/iwspy.exp +++ b/test/lib/completions/iwspy.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/jar.exp b/test/lib/completions/jar.exp index 0e11f684..d2cb476b 100644 --- a/test/lib/completions/jar.exp +++ b/test/lib/completions/jar.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/jarsigner.exp b/test/lib/completions/jarsigner.exp index 075e0263..7ea7cb2e 100644 --- a/test/lib/completions/jarsigner.exp +++ b/test/lib/completions/jarsigner.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/java.exp b/test/lib/completions/java.exp index 14610b2f..842501d2 100644 --- a/test/lib/completions/java.exp +++ b/test/lib/completions/java.exp @@ -1,12 +1,12 @@ proc setup {} { - assert_bash_exec {CLASSPATH=$TESTDIR/fixtures/java/a:$TESTDIR/fixtures/java/bashcomp.jar} + assert_bash_exec {CLASSPATH=$SRCDIR/fixtures/java/a:$SRCDIR/fixtures/java/bashcomp.jar} save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -25,7 +25,7 @@ sync_after_int assert_complete "bashcomp.jarred toplevel" \ - "java -cp fixtures/java/bashcomp.jar " + "java -cp $::srcdir/fixtures/java/bashcomp.jar " sync_after_int @@ -37,7 +37,7 @@ assert_no_complete "java -cp \"\" " sync_after_int -assert_complete "a/ bashcomp.jar" "java -jar fixtures/java/" +assert_complete "a/ bashcomp.jar" "java -jar $::srcdir/fixtures/java/" sync_after_int diff --git a/test/lib/completions/javac.exp b/test/lib/completions/javac.exp index 6013de11..948fe8c8 100644 --- a/test/lib/completions/javac.exp +++ b/test/lib/completions/javac.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/javadoc.exp b/test/lib/completions/javadoc.exp index 40c922ca..0af8a3da 100644 --- a/test/lib/completions/javadoc.exp +++ b/test/lib/completions/javadoc.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/javaws.exp b/test/lib/completions/javaws.exp new file mode 100644 index 00000000..cb29c65a --- /dev/null +++ b/test/lib/completions/javaws.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "javaws " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/k3b.exp b/test/lib/completions/k3b.exp index 86942d67..cde14b86 100644 --- a/test/lib/completions/k3b.exp +++ b/test/lib/completions/k3b.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/kdvi.exp b/test/lib/completions/kdvi.exp index 0196049a..fa993f5e 100644 --- a/test/lib/completions/kdvi.exp +++ b/test/lib/completions/kdvi.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified {/OLDPWD=/d} -}; # teardown() +} setup @@ -18,7 +18,7 @@ set files { foo/ .dvi .DVI .dvi.bz2 .DVI.bz2 .dvi.gz .DVI.gz .dvi.Z .DVI.Z } -assert_complete_dir $files "kdvi " "fixtures/kdvi" +assert_complete_dir $files "kdvi " "$::srcdir/fixtures/kdvi" sync_after_int diff --git a/test/lib/completions/kill.exp b/test/lib/completions/kill.exp index ca02650c..1e80fe69 100644 --- a/test/lib/completions/kill.exp +++ b/test/lib/completions/kill.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/killall.exp b/test/lib/completions/killall.exp index 763c8e7d..ae8b3d60 100644 --- a/test/lib/completions/killall.exp +++ b/test/lib/completions/killall.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/kldload.exp b/test/lib/completions/kldload.exp index 0493a10a..a1d87c97 100644 --- a/test/lib/completions/kldload.exp +++ b/test/lib/completions/kldload.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/kldunload.exp b/test/lib/completions/kldunload.exp index 192159a5..476c5104 100644 --- a/test/lib/completions/kldunload.exp +++ b/test/lib/completions/kldunload.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/kpdf.exp b/test/lib/completions/kpdf.exp index 010abcfb..6f0feb68 100644 --- a/test/lib/completions/kpdf.exp +++ b/test/lib/completions/kpdf.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified {/OLDPWD=/d} -}; # teardown() +} setup @@ -17,7 +17,7 @@ setup set files { foo/ .eps .ps .EPS .PS .pdf .PDF } -assert_complete_dir $files "kpdf " "fixtures/kpdf" +assert_complete_dir $files "kpdf " "$::srcdir/fixtures/kpdf" sync_after_int diff --git a/test/lib/completions/kplayer.exp b/test/lib/completions/kplayer.exp index 34c9b3bf..4fdfa672 100644 --- a/test/lib/completions/kplayer.exp +++ b/test/lib/completions/kplayer.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/larch.exp b/test/lib/completions/larch.exp index 076016f2..cefcbe02 100644 --- a/test/lib/completions/larch.exp +++ b/test/lib/completions/larch.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/ld.exp b/test/lib/completions/ld.exp index 60377991..ee660fcb 100644 --- a/test/lib/completions/ld.exp +++ b/test/lib/completions/ld.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/ldd.exp b/test/lib/completions/ldd.exp index e45d1df7..1c3239c7 100644 --- a/test/lib/completions/ldd.exp +++ b/test/lib/completions/ldd.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/less.exp b/test/lib/completions/less.exp index 269c9b5c..78d6ef14 100644 --- a/test/lib/completions/less.exp +++ b/test/lib/completions/less.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/lftp.exp b/test/lib/completions/lftp.exp index a49a1935..bb219650 100644 --- a/test/lib/completions/lftp.exp +++ b/test/lib/completions/lftp.exp @@ -1,12 +1,12 @@ proc setup {} { - assert_bash_exec {HOME=$TESTDIR/fixtures/lftp} + assert_bash_exec {HOME=$SRCDIR/fixtures/lftp} save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/lftpget.exp b/test/lib/completions/lftpget.exp index 7d80216e..0eadb6e9 100644 --- a/test/lib/completions/lftpget.exp +++ b/test/lib/completions/lftpget.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/lilo.exp b/test/lib/completions/lilo.exp index 505a1470..36ea2c66 100644 --- a/test/lib/completions/lilo.exp +++ b/test/lib/completions/lilo.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/links.exp b/test/lib/completions/links.exp index 9f4896aa..4124e2f4 100644 --- a/test/lib/completions/links.exp +++ b/test/lib/completions/links.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/lisp.exp b/test/lib/completions/lisp.exp index 21663628..5131b45d 100644 --- a/test/lib/completions/lisp.exp +++ b/test/lib/completions/lisp.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/list_admins.exp b/test/lib/completions/list_admins.exp index e1c9c4dd..3b412136 100644 --- a/test/lib/completions/list_admins.exp +++ b/test/lib/completions/list_admins.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/list_lists.exp b/test/lib/completions/list_lists.exp index 789ab1a8..a62dca25 100644 --- a/test/lib/completions/list_lists.exp +++ b/test/lib/completions/list_lists.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/list_members.exp b/test/lib/completions/list_members.exp index c93b53d7..8c74cdfb 100644 --- a/test/lib/completions/list_members.exp +++ b/test/lib/completions/list_members.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/list_owners.exp b/test/lib/completions/list_owners.exp index c96e0229..65e3ba8e 100644 --- a/test/lib/completions/list_owners.exp +++ b/test/lib/completions/list_owners.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/ln.exp b/test/lib/completions/ln.exp index 34786071..61405020 100644 --- a/test/lib/completions/ln.exp +++ b/test/lib/completions/ln.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/look.exp b/test/lib/completions/look.exp index 53a3c464..8f93db24 100644 --- a/test/lib/completions/look.exp +++ b/test/lib/completions/look.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {look foo | grep ^foo} words]} { assert_complete $words "look foo" -}; # if +} sync_after_int diff --git a/test/lib/completions/lrzip.exp b/test/lib/completions/lrzip.exp new file mode 100644 index 00000000..97bc1235 --- /dev/null +++ b/test/lib/completions/lrzip.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "lrzip " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ls.exp b/test/lib/completions/ls.exp index db2d41d3..0d16ec03 100644 --- a/test/lib/completions/ls.exp +++ b/test/lib/completions/ls.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,29 @@ setup if {[assert_exec {ls --help} "" "" "unsupported"]} { assert_complete_any "ls --" -}; # if +} + + +sync_after_int + + +set test "~part should complete to ~full/ if existing dir" +# 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" +# 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/lsof.exp b/test/lib/completions/lsof.exp new file mode 100644 index 00000000..551bde2a --- /dev/null +++ b/test/lib/completions/lsof.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "lsof " +sync_after_int + +assert_complete_any "lsof -" +sync_after_int + + +teardown diff --git a/test/lib/completions/lvchange.exp b/test/lib/completions/lvchange.exp index ec3886b8..6587a260 100644 --- a/test/lib/completions/lvchange.exp +++ b/test/lib/completions/lvchange.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/lvcreate.exp b/test/lib/completions/lvcreate.exp index 46dceb79..91cb0d81 100644 --- a/test/lib/completions/lvcreate.exp +++ b/test/lib/completions/lvcreate.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/lvdisplay.exp b/test/lib/completions/lvdisplay.exp index 5a01a0e5..6fa9c294 100644 --- a/test/lib/completions/lvdisplay.exp +++ b/test/lib/completions/lvdisplay.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/lvextend.exp b/test/lib/completions/lvextend.exp index 24a63853..ded34695 100644 --- a/test/lib/completions/lvextend.exp +++ b/test/lib/completions/lvextend.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/lvm.exp b/test/lib/completions/lvm.exp index 1c67825e..91fe0dcd 100644 --- a/test/lib/completions/lvm.exp +++ b/test/lib/completions/lvm.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/lvmdiskscan.exp b/test/lib/completions/lvmdiskscan.exp index 27e566d4..6553865f 100644 --- a/test/lib/completions/lvmdiskscan.exp +++ b/test/lib/completions/lvmdiskscan.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/lvreduce.exp b/test/lib/completions/lvreduce.exp index edd5150d..e2708f89 100644 --- a/test/lib/completions/lvreduce.exp +++ b/test/lib/completions/lvreduce.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/lvremove.exp b/test/lib/completions/lvremove.exp index 1cd63150..8ca1517b 100644 --- a/test/lib/completions/lvremove.exp +++ b/test/lib/completions/lvremove.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/lvrename.exp b/test/lib/completions/lvrename.exp index 51624222..17179ce9 100644 --- a/test/lib/completions/lvrename.exp +++ b/test/lib/completions/lvrename.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/lvresize.exp b/test/lib/completions/lvresize.exp index 830b9ab1..2b3e1044 100644 --- a/test/lib/completions/lvresize.exp +++ b/test/lib/completions/lvresize.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/lvs.exp b/test/lib/completions/lvs.exp index 8b239f5d..e531f7e9 100644 --- a/test/lib/completions/lvs.exp +++ b/test/lib/completions/lvs.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/lvscan.exp b/test/lib/completions/lvscan.exp index 841fd0ed..7b09e5e1 100644 --- a/test/lib/completions/lvscan.exp +++ b/test/lib/completions/lvscan.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/lzma.exp b/test/lib/completions/lzma.exp index 79d78854..ba57d10b 100644 --- a/test/lib/completions/lzma.exp +++ b/test/lib/completions/lzma.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -17,7 +17,7 @@ assert_complete_any "lzma " sync_after_int -assert_complete "a/ bashcomp.lzma bashcomp.tlz" "lzma -d fixtures/xz/" +assert_complete "a/ bashcomp.lzma bashcomp.tlz" "lzma -d $::srcdir/fixtures/xz/" sync_after_int diff --git a/test/lib/completions/lzop.exp b/test/lib/completions/lzop.exp index c33e814e..a7d3da25 100644 --- a/test/lib/completions/lzop.exp +++ b/test/lib/completions/lzop.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/m4.exp b/test/lib/completions/m4.exp index 2cc884b3..334132db 100644 --- a/test/lib/completions/m4.exp +++ b/test/lib/completions/m4.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {m4 --help} "" "" "unsupported"]} { assert_complete_any "m4 --" -}; # if +} sync_after_int diff --git a/test/lib/completions/macof.exp b/test/lib/completions/macof.exp index e21b1e77..873ae1da 100644 --- a/test/lib/completions/macof.exp +++ b/test/lib/completions/macof.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/mailmanctl.exp b/test/lib/completions/mailmanctl.exp index a69b7650..2924806a 100644 --- a/test/lib/completions/mailmanctl.exp +++ b/test/lib/completions/mailmanctl.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/mailsnarf.exp b/test/lib/completions/mailsnarf.exp index df9981b7..9fb937f3 100644 --- a/test/lib/completions/mailsnarf.exp +++ b/test/lib/completions/mailsnarf.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/make.exp b/test/lib/completions/make.exp index 90b9e68b..64a393da 100644 --- a/test/lib/completions/make.exp +++ b/test/lib/completions/make.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/man.exp b/test/lib/completions/man.exp index 62c14c86..c7358c62 100644 --- a/test/lib/completions/man.exp +++ b/test/lib/completions/man.exp @@ -1,17 +1,30 @@ proc setup {} { + assert_bash_exec "export MANPATH=$::srcdirabs/fixtures/man" save_env -}; # setup() +} proc teardown {} { - assert_env_unmodified -}; # teardown() + assert_env_unmodified {/OLDPWD/d} +} setup -assert_complete_any "man man" +assert_complete "bar" "man b" + + +sync_after_int + + +assert_complete_dir oo.1 "man man1/f" $::srcdir/fixtures/man + + +sync_after_int + + +assert_complete "Bash::Completion" "man Bash::C" sync_after_int diff --git a/test/lib/completions/mc.exp b/test/lib/completions/mc.exp index 866161ba..eb97246d 100644 --- a/test/lib/completions/mc.exp +++ b/test/lib/completions/mc.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/mcrypt.exp b/test/lib/completions/mcrypt.exp index bfc5d2d2..525ccbc3 100644 --- a/test/lib/completions/mcrypt.exp +++ b/test/lib/completions/mcrypt.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/md5sum.exp b/test/lib/completions/md5sum.exp index 25290b56..54ed6416 100644 --- a/test/lib/completions/md5sum.exp +++ b/test/lib/completions/md5sum.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/mdecrypt.exp b/test/lib/completions/mdecrypt.exp index 4e49ae12..8d9d9f59 100644 --- a/test/lib/completions/mdecrypt.exp +++ b/test/lib/completions/mdecrypt.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/mencoder.exp b/test/lib/completions/mencoder.exp index 169dcb71..db29f66a 100644 --- a/test/lib/completions/mencoder.exp +++ b/test/lib/completions/mencoder.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/minicom.exp b/test/lib/completions/minicom.exp index 935502f1..dfc96c01 100644 --- a/test/lib/completions/minicom.exp +++ b/test/lib/completions/minicom.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/mkdir.exp b/test/lib/completions/mkdir.exp index 43dfec7e..8d8c881d 100644 --- a/test/lib/completions/mkdir.exp +++ b/test/lib/completions/mkdir.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -17,4 +17,10 @@ assert_complete_any "mkdir " sync_after_int +assert_complete {"bar bar.d/" foo.d/} "mkdir $::srcdir/fixtures/shared/default/" + + +sync_after_int + + teardown diff --git a/test/lib/completions/mkfifo.exp b/test/lib/completions/mkfifo.exp index c6343f8d..59412a2e 100644 --- a/test/lib/completions/mkfifo.exp +++ b/test/lib/completions/mkfifo.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/mkinitrd.exp b/test/lib/completions/mkinitrd.exp index cfb316e5..007f278d 100644 --- a/test/lib/completions/mkinitrd.exp +++ b/test/lib/completions/mkinitrd.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/mkisofs.exp b/test/lib/completions/mkisofs.exp index ad24ea06..98780b1e 100644 --- a/test/lib/completions/mkisofs.exp +++ b/test/lib/completions/mkisofs.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -25,7 +25,7 @@ expect { -re "^$cmd\r\n\\d+.*$cmd$" { pass "$test" } -re /@ { unresolved "$test at prompt" } -re eof { unresolved "eof" } -}; # expect +} sync_after_int @@ -39,7 +39,7 @@ expect { -re "^$cmd\r\n\\d+.*$cmd$" { pass "$test" } -re /@ { unresolved "$test at prompt" } -re eof { unresolved "eof" } -}; # expect +} sync_after_int diff --git a/test/lib/completions/mknod.exp b/test/lib/completions/mknod.exp index 2c58cade..145f4531 100644 --- a/test/lib/completions/mknod.exp +++ b/test/lib/completions/mknod.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/mktemp.exp b/test/lib/completions/mktemp.exp new file mode 100644 index 00000000..8b0a3be2 --- /dev/null +++ b/test/lib/completions/mktemp.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "mktemp -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mmsitepass.exp b/test/lib/completions/mmsitepass.exp index d69fa202..4dde214f 100644 --- a/test/lib/completions/mmsitepass.exp +++ b/test/lib/completions/mmsitepass.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/module.exp b/test/lib/completions/module.exp index a34667d4..5e36a6da 100644 --- a/test/lib/completions/module.exp +++ b/test/lib/completions/module.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/mogrify.exp b/test/lib/completions/mogrify.exp index ef7e18ee..84ceeff5 100644 --- a/test/lib/completions/mogrify.exp +++ b/test/lib/completions/mogrify.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/montage.exp b/test/lib/completions/montage.exp index 736609a5..4d85e1a4 100644 --- a/test/lib/completions/montage.exp +++ b/test/lib/completions/montage.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/mount.exp b/test/lib/completions/mount.exp index 38d93e3b..c99d6058 100644 --- a/test/lib/completions/mount.exp +++ b/test/lib/completions/mount.exp @@ -5,11 +5,10 @@ proc setup_dummy_mnt {} { assert_bash_exec {unset COMPREPLY cur} assert_bash_exec {unset -f _mnt} - global TESTDIR assert_bash_exec { \ _mnt() { \ local cur=$(_get_cword); \ - _linux_fstab $(_get_pword) < "$TESTDIR/fixtures/mount/test-fstab"; \ + _linux_fstab $(_get_pword) < "$SRCDIRABS/fixtures/mount/test-fstab"; \ }; \ complete -F _mnt mnt \ } @@ -53,9 +52,9 @@ sync_after_int set test "Check completing nfs mounts" set expected [list /test/path /test/path2 /second/path] set cmd "mount mocksrv:/" -assert_bash_exec {OLDPATH="$PATH"; PATH="$TESTDIR/fixtures/mount/bin:$PATH";} +assert_bash_exec {OLDPATH="$PATH"; PATH="$SRCDIRABS/fixtures/mount/bin:$PATH";} # This needs an explicit cword param or will output "unresolved". -assert_complete $expected $cmd $test "/@" 20 "/" +assert_complete $expected $cmd $test -expect-cmd-minus / sync_after_int assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} @@ -94,7 +93,7 @@ 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\ } "" /@ 20 {/mnt/nice\ } + {mnt /mnt/nice\ } "" -expect-cmd-minus {/mnt/nice\ } sync_after_int assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$} diff --git a/test/lib/completions/mplayer.exp b/test/lib/completions/mplayer.exp index 69e5d971..9230a86d 100644 --- a/test/lib/completions/mplayer.exp +++ b/test/lib/completions/mplayer.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/msgsnarf.exp b/test/lib/completions/msgsnarf.exp index 74f458ff..c542e33e 100644 --- a/test/lib/completions/msgsnarf.exp +++ b/test/lib/completions/msgsnarf.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/mtx.exp b/test/lib/completions/mtx.exp index a518d79f..1de15269 100644 --- a/test/lib/completions/mtx.exp +++ b/test/lib/completions/mtx.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/mutt.exp b/test/lib/completions/mutt.exp index 6c727daf..8cb8b0c6 100644 --- a/test/lib/completions/mutt.exp +++ b/test/lib/completions/mutt.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified {/OLDPWD=/d} -}; # teardown() +} setup @@ -19,12 +19,12 @@ sync_after_int set test "mutt should complete mailboxes" set expected {foo/ bar/ muttrc} -assert_complete_dir $expected "mutt -F muttrc -f =" fixtures/mutt +assert_complete_dir $expected "mutt -F muttrc -f =" $::srcdir/fixtures/mutt set test "mutt should complete aliases" set expected {a1 a2} -assert_complete_dir $expected "mutt -F muttrc -A " fixtures/mutt +assert_complete_dir $expected "mutt -F muttrc -A " $::srcdir/fixtures/mutt sync_after_int diff --git a/test/lib/completions/muttng.exp b/test/lib/completions/muttng.exp index 25a474ad..32239128 100644 --- a/test/lib/completions/muttng.exp +++ b/test/lib/completions/muttng.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/mv.exp b/test/lib/completions/mv.exp index f2576df7..d65c4868 100644 --- a/test/lib/completions/mv.exp +++ b/test/lib/completions/mv.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/mysqladmin.exp b/test/lib/completions/mysqladmin.exp index 76381587..ae9b8ce8 100644 --- a/test/lib/completions/mysqladmin.exp +++ b/test/lib/completions/mysqladmin.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/ncftp.exp b/test/lib/completions/ncftp.exp index ad71f226..52d70756 100644 --- a/test/lib/completions/ncftp.exp +++ b/test/lib/completions/ncftp.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/netstat.exp b/test/lib/completions/netstat.exp index 0e6414d6..e4ef676c 100644 --- a/test/lib/completions/netstat.exp +++ b/test/lib/completions/netstat.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/newlist.exp b/test/lib/completions/newlist.exp index bebf600d..0696ec5e 100644 --- a/test/lib/completions/newlist.exp +++ b/test/lib/completions/newlist.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/nl.exp b/test/lib/completions/nl.exp index 02076dff..b7255ac2 100644 --- a/test/lib/completions/nl.exp +++ b/test/lib/completions/nl.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/nm.exp b/test/lib/completions/nm.exp index 551f49e9..9ce73d45 100644 --- a/test/lib/completions/nm.exp +++ b/test/lib/completions/nm.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/ntpdate.exp b/test/lib/completions/ntpdate.exp index 6a6456f4..7a7dd716 100644 --- a/test/lib/completions/ntpdate.exp +++ b/test/lib/completions/ntpdate.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/objcopy.exp b/test/lib/completions/objcopy.exp index acb6539a..29be7e62 100644 --- a/test/lib/completions/objcopy.exp +++ b/test/lib/completions/objcopy.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/objdump.exp b/test/lib/completions/objdump.exp index 5eec35d6..c1f62e35 100644 --- a/test/lib/completions/objdump.exp +++ b/test/lib/completions/objdump.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/od.exp b/test/lib/completions/od.exp index 5838218c..e2712d12 100644 --- a/test/lib/completions/od.exp +++ b/test/lib/completions/od.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/openssl.exp b/test/lib/completions/openssl.exp index 651e5e6d..25fc1367 100644 --- a/test/lib/completions/openssl.exp +++ b/test/lib/completions/openssl.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -19,7 +19,7 @@ expect { -re "^$cmd\r\n.*$cmd$" { pass "$test" } -re /@ { unresolved "$test at prompt" } -re eof { unresolved "eof" } -}; # expect +} sync_after_int diff --git a/test/lib/completions/p4.exp b/test/lib/completions/p4.exp index 369d2c6b..20d8fb6e 100644 --- a/test/lib/completions/p4.exp +++ b/test/lib/completions/p4.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/pack200.exp b/test/lib/completions/pack200.exp index f96eff13..537bf327 100644 --- a/test/lib/completions/pack200.exp +++ b/test/lib/completions/pack200.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/paste.exp b/test/lib/completions/paste.exp index 3a4e93be..224d9dd9 100644 --- a/test/lib/completions/paste.exp +++ b/test/lib/completions/paste.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/patch.exp b/test/lib/completions/patch.exp index a44fa130..07e88f15 100644 --- a/test/lib/completions/patch.exp +++ b/test/lib/completions/patch.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/perl.exp b/test/lib/completions/perl.exp index 2199c994..8cd6f957 100644 --- a/test/lib/completions/perl.exp +++ b/test/lib/completions/perl.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -18,7 +18,7 @@ sync_after_int set test "Second argument should file complete" -set cmd "perl foo fixtures/shared/default/f" +set cmd "perl foo $::srcdir/fixtures/shared/default/f" send "$cmd\t" expect { -re "^$cmd\r\nfoo +foo.d/ *\r\n/@${cmd}oo$" { pass "$test" } @@ -31,7 +31,7 @@ sync_after_int set test "-I without space should complete directories" -set cmd "perl -Ifixtures/shared/default/" +set cmd "perl -I$::srcdir/fixtures/shared/default/" send "$cmd\t" expect { -re "^$cmd\r\nbar bar.d/ +foo.d/ *\r\n/@$cmd$" { pass "$test" } @@ -44,7 +44,7 @@ sync_after_int set test "-I with space should complete directories" -set cmd "perl -I fixtures/shared/default/" +set cmd "perl -I $::srcdir/fixtures/shared/default/" send "$cmd\t" expect { -re "^$cmd\r\nbar bar.d/ +foo.d/ *\r\n/@$cmd$" { pass "$test" } @@ -57,7 +57,7 @@ sync_after_int set test "-x without space should complete directories" -set cmd "perl -xfixtures/shared/default/b" +set cmd "perl -x$::srcdir/fixtures/shared/default/b" send "$cmd\t" expect { -re "^${cmd}ar\\\\ bar.d/ *$" { pass "$test" } @@ -70,7 +70,7 @@ sync_after_int set test "-x with space should complete directories" -set cmd "perl -x fixtures/shared/default/b" +set cmd "perl -x $::srcdir/fixtures/shared/default/b" send "$cmd\t" expect { -re "^${cmd}ar\\\\ bar.d/ *$" { pass "$test" } @@ -91,5 +91,30 @@ assert_complete $options "perl -" sync_after_int +assert_no_complete "perl -e " +sync_after_int + +assert_complete_any "perl -V:install" +sync_after_int + +assert_complete_any "perl -V::install" +sync_after_int + +# Assuming that File::Spec and friends are always installed... + +assert_complete_any "perl -MFile" +sync_after_int + +assert_complete_any "perl -MFile::Sp" +sync_after_int + +assert_complete_any "perl -MFile::Spec::Func" +sync_after_int + +assert_complete_any "perl -M-File" +sync_after_int + +assert_complete_any "perl -m-File::" +sync_after_int teardown diff --git a/test/lib/completions/perldoc.exp b/test/lib/completions/perldoc.exp index b3ff83b3..dc1c79c8 100644 --- a/test/lib/completions/perldoc.exp +++ b/test/lib/completions/perldoc.exp @@ -1,22 +1,16 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup -assert_complete_any "perldoc -" - - -sync_after_int - - set test "perldoc should complete word containing colons" set cmd "perldoc File::" send "$cmd\t" @@ -29,7 +23,16 @@ expect { -re "perldoc File::File::" { fail "$test" } -re /@ { unresolved "$test" } default { unresolved "$test" } -}; # expect +} + + +sync_after_int + +set test "- should complete options" +set options { + -h -v -t -u -m -l -F -X -f -q +} +assert_complete $options "perldoc -" sync_after_int diff --git a/test/lib/completions/pgrep.exp b/test/lib/completions/pgrep.exp index 63143acc..c27c4f21 100644 --- a/test/lib/completions/pgrep.exp +++ b/test/lib/completions/pgrep.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/pine.exp b/test/lib/completions/pine.exp index 0a0c3f40..622bf064 100644 --- a/test/lib/completions/pine.exp +++ b/test/lib/completions/pine.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/ping.exp b/test/lib/completions/ping.exp index b600849b..3e419966 100644 --- a/test/lib/completions/ping.exp +++ b/test/lib/completions/ping.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/pkg-config.exp b/test/lib/completions/pkg-config.exp index 477dba08..adf9a301 100644 --- a/test/lib/completions/pkg-config.exp +++ b/test/lib/completions/pkg-config.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/pkg_deinstall.exp b/test/lib/completions/pkg_deinstall.exp index 8f3d8c3d..c2b3ae0b 100644 --- a/test/lib/completions/pkg_deinstall.exp +++ b/test/lib/completions/pkg_deinstall.exp @@ -1,18 +1,18 @@ proc setup {} { - assert_bash_exec {PKG_DBDIR=fixtures/pkgtools/db} + assert_bash_exec {PKG_DBDIR=$::srcdir/fixtures/pkgtools/db} save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup -set pkgs [exec bash -c "cd fixtures/pkgtools/db ; compgen -d"] +set pkgs [exec bash -c "cd $::srcdir/fixtures/pkgtools/db ; compgen -d"] assert_complete $pkgs "pkg_deinstall " diff --git a/test/lib/completions/pkg_delete.exp b/test/lib/completions/pkg_delete.exp index b0c1a2a5..37ce4035 100644 --- a/test/lib/completions/pkg_delete.exp +++ b/test/lib/completions/pkg_delete.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/pkg_info.exp b/test/lib/completions/pkg_info.exp index 3f253ccf..ad8ed84e 100644 --- a/test/lib/completions/pkg_info.exp +++ b/test/lib/completions/pkg_info.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/pkill.exp b/test/lib/completions/pkill.exp index 0333fc94..6faddfc3 100644 --- a/test/lib/completions/pkill.exp +++ b/test/lib/completions/pkill.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/portinstall.exp b/test/lib/completions/portinstall.exp index d70f5db6..ab14afa8 100644 --- a/test/lib/completions/portinstall.exp +++ b/test/lib/completions/portinstall.exp @@ -1,13 +1,13 @@ proc setup {} { - assert_bash_exec {PORTSDIR=fixtures/pkgtools/ports ; sed -e s,PORTSDIR,$PORTSDIR,g $PORTSDIR/INDEX.dist > $PORTSDIR/INDEX ; cp $PORTSDIR/INDEX $PORTSDIR/INDEX-5} + assert_bash_exec {PORTSDIR=$TESTDIR/tmp; sed -e s,PORTSDIR,$PORTSDIR,g $::srcdir/fixtures/pkgtools/ports/INDEX.dist > $PORTSDIR/INDEX; cp $PORTSDIR/INDEX $PORTSDIR/INDEX-5} save_env -}; # setup() +} proc teardown {} { - assert_bash_exec {rm fixtures/pkgtools/ports/INDEX fixtures/pkgtools/ports/INDEX-5} + assert_bash_exec {rm $PORTSDIR/INDEX $PORTSDIR/INDEX-5} assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/portupgrade.exp b/test/lib/completions/portupgrade.exp index cb583923..62b5789d 100644 --- a/test/lib/completions/portupgrade.exp +++ b/test/lib/completions/portupgrade.exp @@ -1,12 +1,12 @@ proc setup {} { assert_bash_exec {PKG_DBDIR=fixtures/pkgtools/db} save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/povray.exp b/test/lib/completions/povray.exp index 1efeeddb..30d58e48 100644 --- a/test/lib/completions/povray.exp +++ b/test/lib/completions/povray.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/pr.exp b/test/lib/completions/pr.exp index 5d7a96c3..478017b2 100644 --- a/test/lib/completions/pr.exp +++ b/test/lib/completions/pr.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/psql.exp b/test/lib/completions/psql.exp index 56d56666..3dbffaf2 100644 --- a/test/lib/completions/psql.exp +++ b/test/lib/completions/psql.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/ptx.exp b/test/lib/completions/ptx.exp index 2defe049..220243c3 100644 --- a/test/lib/completions/ptx.exp +++ b/test/lib/completions/ptx.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/pvchange.exp b/test/lib/completions/pvchange.exp index fd4b73d0..a43ae9cd 100644 --- a/test/lib/completions/pvchange.exp +++ b/test/lib/completions/pvchange.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/pvcreate.exp b/test/lib/completions/pvcreate.exp index 47cebf7a..6bc9d4eb 100644 --- a/test/lib/completions/pvcreate.exp +++ b/test/lib/completions/pvcreate.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/pvdisplay.exp b/test/lib/completions/pvdisplay.exp index 151064cd..b9db558b 100644 --- a/test/lib/completions/pvdisplay.exp +++ b/test/lib/completions/pvdisplay.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/pvmove.exp b/test/lib/completions/pvmove.exp index 81c05e98..24d17006 100644 --- a/test/lib/completions/pvmove.exp +++ b/test/lib/completions/pvmove.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/pvremove.exp b/test/lib/completions/pvremove.exp index dd145bf6..1febcf37 100644 --- a/test/lib/completions/pvremove.exp +++ b/test/lib/completions/pvremove.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/pvs.exp b/test/lib/completions/pvs.exp index 6e5527e1..e50501a3 100644 --- a/test/lib/completions/pvs.exp +++ b/test/lib/completions/pvs.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/pvscan.exp b/test/lib/completions/pvscan.exp index e92cdbe0..d3b8ad33 100644 --- a/test/lib/completions/pvscan.exp +++ b/test/lib/completions/pvscan.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/python.exp b/test/lib/completions/python.exp index c9d70b43..446e3d09 100644 --- a/test/lib/completions/python.exp +++ b/test/lib/completions/python.exp @@ -1,19 +1,20 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup assert_complete_any "python " +sync_after_int - +assert_complete_any "python -" sync_after_int diff --git a/test/lib/completions/qrunner.exp b/test/lib/completions/qrunner.exp index b8fcf191..0dec16cc 100644 --- a/test/lib/completions/qrunner.exp +++ b/test/lib/completions/qrunner.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/querybts.exp b/test/lib/completions/querybts.exp index dc75cd62..4ed09d8a 100644 --- a/test/lib/completions/querybts.exp +++ b/test/lib/completions/querybts.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/rcs.exp b/test/lib/completions/rcs.exp index 19ae4d50..781ac37f 100644 --- a/test/lib/completions/rcs.exp +++ b/test/lib/completions/rcs.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/rcsdiff.exp b/test/lib/completions/rcsdiff.exp index 8383cdb9..23b009c6 100644 --- a/test/lib/completions/rcsdiff.exp +++ b/test/lib/completions/rcsdiff.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/rdict.exp b/test/lib/completions/rdict.exp index aa132617..5d6ad847 100644 --- a/test/lib/completions/rdict.exp +++ b/test/lib/completions/rdict.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/readelf.exp b/test/lib/completions/readelf.exp index a084a41e..c2d5ee5b 100644 --- a/test/lib/completions/readelf.exp +++ b/test/lib/completions/readelf.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/readonly.exp b/test/lib/completions/readonly.exp index 84be3c96..cf64ca0a 100644 --- a/test/lib/completions/readonly.exp +++ b/test/lib/completions/readonly.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/remove_members.exp b/test/lib/completions/remove_members.exp index 63d6a70e..59f7b6c4 100644 --- a/test/lib/completions/remove_members.exp +++ b/test/lib/completions/remove_members.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/removepkg.exp b/test/lib/completions/removepkg.exp index 7cf98805..882f1e70 100644 --- a/test/lib/completions/removepkg.exp +++ b/test/lib/completions/removepkg.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/renice.exp b/test/lib/completions/renice.exp index c91e0212..fdc859b4 100644 --- a/test/lib/completions/renice.exp +++ b/test/lib/completions/renice.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -19,7 +19,7 @@ expect { -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" } -re /@ { unresolved "$test at prompt" } -re eof { unresolved "eof" } -}; # expect +} sync_after_int @@ -33,7 +33,7 @@ expect { -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" } -re /@ { unresolved "$test at prompt" } -re eof { unresolved "eof" } -}; # expect +} sync_after_int diff --git a/test/lib/completions/reportbug.exp b/test/lib/completions/reportbug.exp index 1f66df2c..660778f7 100644 --- a/test/lib/completions/reportbug.exp +++ b/test/lib/completions/reportbug.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/ri.exp b/test/lib/completions/ri.exp index 160dc9a7..cd138ea0 100644 --- a/test/lib/completions/ri.exp +++ b/test/lib/completions/ri.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/rlog.exp b/test/lib/completions/rlog.exp index cbc06857..87984a8d 100644 --- a/test/lib/completions/rlog.exp +++ b/test/lib/completions/rlog.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/rm.exp b/test/lib/completions/rm.exp index ae670e83..f764a8e7 100644 --- a/test/lib/completions/rm.exp +++ b/test/lib/completions/rm.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/rmdir.exp b/test/lib/completions/rmdir.exp index 2b23a9c5..1a904b64 100644 --- a/test/lib/completions/rmdir.exp +++ b/test/lib/completions/rmdir.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -17,4 +17,10 @@ assert_complete_any "rmdir " sync_after_int +assert_complete {"bar bar.d/" foo.d/} "rmdir $::srcdir/fixtures/shared/default/" + + +sync_after_int + + teardown diff --git a/test/lib/completions/rmlist.exp b/test/lib/completions/rmlist.exp index 91519ee8..d530d117 100644 --- a/test/lib/completions/rmlist.exp +++ b/test/lib/completions/rmlist.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/rpcdebug.exp b/test/lib/completions/rpcdebug.exp index 8629c947..7f1a1c2f 100644 --- a/test/lib/completions/rpcdebug.exp +++ b/test/lib/completions/rpcdebug.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/rpm.exp b/test/lib/completions/rpm.exp index 3ed154a9..82ab28dc 100644 --- a/test/lib/completions/rpm.exp +++ b/test/lib/completions/rpm.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -20,7 +20,7 @@ sync_after_int # Build list of installed packages if {[assert_exec {rpm -qa --qf=%\{NAME\}\n | sort -u} packages]} { assert_complete $packages "rpm -q " -}; # if +} sync_after_int diff --git a/test/lib/completions/rsync.exp b/test/lib/completions/rsync.exp index fb301a35..221d090b 100644 --- a/test/lib/completions/rsync.exp +++ b/test/lib/completions/rsync.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/rtcwake.exp b/test/lib/completions/rtcwake.exp index 0b9a974b..21c05eab 100644 --- a/test/lib/completions/rtcwake.exp +++ b/test/lib/completions/rtcwake.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/sbcl-mt.exp b/test/lib/completions/sbcl-mt.exp index 45e81f79..a80e543b 100644 --- a/test/lib/completions/sbcl-mt.exp +++ b/test/lib/completions/sbcl-mt.exp @@ -1,17 +1,17 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup -assert_complete {bar "bar bar.d/" foo foo.d/} "sbcl-mt fixtures/shared/default/" +assert_complete {bar "bar bar.d/" foo foo.d/} "sbcl-mt $::srcdir/fixtures/shared/default/" sync_after_int diff --git a/test/lib/completions/sbcl.exp b/test/lib/completions/sbcl.exp index b68b2dce..3adeb6bf 100644 --- a/test/lib/completions/sbcl.exp +++ b/test/lib/completions/sbcl.exp @@ -1,17 +1,17 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup -assert_complete {bar "bar bar.d/" foo foo.d/} "sbcl fixtures/shared/default/" +assert_complete {bar "bar bar.d/" foo foo.d/} "sbcl $::srcdir/fixtures/shared/default/" sync_after_int diff --git a/test/lib/completions/scp.exp b/test/lib/completions/scp.exp index efe2b686..e6cbf8e3 100644 --- a/test/lib/completions/scp.exp +++ b/test/lib/completions/scp.exp @@ -1,15 +1,19 @@ proc setup {} { save_env -}; # setup() + # NOTE: Changing dir to $SRCDIR is necessary because file locations in the + # ssh config files (e.g. UserKnownHostsFile) are relative to $SRCDIR. + assert_bash_exec {cd $SRCDIR/fixtures/scp} +} proc teardown {} { + assert_bash_exec {cd $TESTDIR} assert_env_unmodified { /BASH_LINENO=/d /BASH_SOURCE=/d /OLDPWD=/d } -}; # teardown() +} setup @@ -31,7 +35,7 @@ if { # in `$HOME/.ssh/config' or `/etc/ssh_config' set host_pwd "" unsupported $test -}; # if +} # Try completion @@ -41,7 +45,7 @@ sync_after_tab expect { -re "^$cmd$host_pwd.*$" { pass "$test" } -re /@ { unresolved "$test at prompt" } -}; # expect +} sync_after_int @@ -52,16 +56,15 @@ 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 `doo' and `ike' are defined in ./fixtures/scp/known_hosts + # Hosts `blah', `doo' and `ike' are defined in ./fixtures/scp/known_hosts set expected {} foreach host [get_hosts] { lappend expected "$host:" -}; # foreach -lappend expected doo: gee: hus: ike: +} +lappend expected blah: doo: gee: hus: ike: # Append local filenames lappend expected config known_hosts "spaced\\ \\ conf" -set dir fixtures/scp -assert_complete_dir $expected "scp -F config " $dir +assert_complete $expected "scp -F config " sync_after_int @@ -76,7 +79,7 @@ expect { -re "^$cmd\r\n.*\r\n/@" { pass "$test" } -re /@ { unresolved "$test at prompt" } default { unresolved "$test" } -}; # expect +} sync_after_int @@ -88,30 +91,26 @@ set test "Config file containing space should work" set expected {} foreach host [get_hosts] { lappend expected "$host:" -}; # foreach +} # Hosts `gee', `hus' and `jar' are defined in "./fixtures/scp/spaced conf" - # Hosts `doo' and `ike' are defined in ./fixtures/scp/known_hosts -lappend expected doo: gee: hus: ike: jar: + # Hosts `blah', `doo' and `ike' are defined in ./fixtures/scp/known_hosts +lappend expected blah: doo: gee: hus: ike: jar: # Append local filenames lappend expected config known_hosts "spaced\\ \\ conf" -set dir fixtures/scp -#assert_complete_dir $expected "scp -F 'spaced conf' " $dir -set prompt "/$dir/@" -assert_bash_exec "cd $dir" "" $prompt set cmd "scp -F 'spaced conf' " send "$cmd\t" expect -ex "$cmd\r\n" -if {[match_items [lsort -unique $expected] $test]} { +if {[match_items [lsort -unique $expected] -bash-sort]} { expect { - -re $prompt { pass "$test" } + -re /@ { pass "$test" } -re eof { unresolved "eof" } - }; # expect + } } else { # Expected failure (known bug) because of bash-4 bug in quoted words: # http://www.mail-archive.com/bug-bash@gnu.org/msg06095.html if {[lindex $::BASH_VERSINFO 0] >= 4} {xfail "$test"} {fail "$test"} -}; # if -sync_after_int $prompt +} +sync_after_int assert_bash_exec {cd "$TESTDIR"} diff --git a/test/lib/completions/screen.exp b/test/lib/completions/screen.exp index 985862c1..e5bc4c15 100644 --- a/test/lib/completions/screen.exp +++ b/test/lib/completions/screen.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified {/OLDPWD=/d} -}; # teardown() +} setup @@ -17,33 +17,8 @@ assert_complete_any "screen -" sync_after_int -set test "-c should complete files/dirs" -set dir fixtures/shared/default -set prompt "/$dir/@" -assert_bash_exec "cd $dir" "" $prompt -set cmd "screen -c " -set expected {bar {bar bar.d} foo {foo.d}} -send "$cmd\t" -expect -ex "$cmd" -expect { - -re "\r\nbar\\s+bar bar.d/\\s+foo\\s+foo.d/" { pass "$test" } - # Directories might not be suffixed with a slash (/). This is because - # _filedir only works if `-o filenames' is in effect, which isn't the - # case for `screen' on bash-3, so an expected failure (xfail) - -re "\r\nbar\\s+bar bar.d\\s+foo\\s+foo.d" { - if {[lindex $::BASH_VERSINFO 0] < 4} {xfail "$test"} {fail "$test"} - } - -re "\r\nbar\\s+bar\\\\ bar.d/\\s+foo\\s+foo.d/" { - # On bash-3, the space in `bar bar.d' is escaped with a backslash - # as a side-effect of emulating `-o filenames'. - if {[lindex $::BASH_VERSINFO 0] <= 3} {pass "$test"} {fail "$test"} - } - -re $prompt { unresolved "$test at prompt" } - default { unresolved "$test" } -}; # expect -sync_after_int $prompt -assert_bash_exec {cd "$TESTDIR"} - +assert_complete {bar "bar bar.d/" foo foo.d/} \ + "screen -c $::srcdir/fixtures/shared/default/" "-c should complete files/dirs" sync_after_int diff --git a/test/lib/completions/sed.exp b/test/lib/completions/sed.exp index 8764cfb8..dd480a60 100644 --- a/test/lib/completions/sed.exp +++ b/test/lib/completions/sed.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {sed --help} "" "" "unsupported"]} { assert_complete_any "sed --" -}; # if +} sync_after_int diff --git a/test/lib/completions/seq.exp b/test/lib/completions/seq.exp index b5333ef9..6e5ef8dc 100644 --- a/test/lib/completions/seq.exp +++ b/test/lib/completions/seq.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/service.exp b/test/lib/completions/service.exp index 917c5dcb..f3cf7355 100644 --- a/test/lib/completions/service.exp +++ b/test/lib/completions/service.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/set.exp b/test/lib/completions/set.exp index 2b2d40e9..c14ecff6 100644 --- a/test/lib/completions/set.exp +++ b/test/lib/completions/set.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/sftp.exp b/test/lib/completions/sftp.exp index 24c37cb5..27fe7511 100644 --- a/test/lib/completions/sftp.exp +++ b/test/lib/completions/sftp.exp @@ -1,15 +1,19 @@ proc setup {} { save_env -}; # setup() + # NOTE: Changing dir to $SRCDIR is necessary because file locations in the + # ssh config files (e.g. UserKnownHostsFile) are relative to $SRCDIR. + assert_bash_exec {cd $SRCDIR/fixtures/sftp} +} proc teardown {} { + assert_bash_exec {cd $TESTDIR} assert_env_unmodified { /BASH_LINENO=/d /BASH_SOURCE=/d /OLDPWD=/d } -}; # teardown() +} setup @@ -18,10 +22,9 @@ setup # Build string list of expected completions set expected [get_hosts] # Hosts `gee' and `hus' are defined in ./fixtures/sftp/config - # Hosts `doo' and `ike' are defined in ./fixtures/sftp/known_hosts -lappend expected doo gee hus ike -set dir fixtures/scp -assert_complete_dir $expected "sftp -F config " $dir + # 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 +assert_complete $expected "sftp -F config " sync_after_int @@ -36,7 +39,7 @@ expect { -re "^$cmd\r\n.*\r\n/@" { pass "$test" } -re /@ { unresolved "$test at prompt" } default { unresolved "$test" } -}; # expect +} sync_after_int @@ -45,33 +48,17 @@ 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/scp/spaced conf" - # Hosts `doo' and `ike' are defined in ./fixtures/scp/known_hosts -lappend expected doo gee hus ike jar -set dir fixtures/sftp -assert_complete_dir $expected "sftp -F spaced\\ \\ conf " $dir + # Hosts `gee', `hus' 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 +assert_complete $expected "sftp -F spaced\\ \\ conf " sync_after_int -set test "-F should complete filename" -set dir fixtures/sftp -set prompt "/$dir/@" -assert_bash_exec "cd $dir" "" $prompt -set cmd "ssh -Fsp" -send "$cmd\t" -expect -ex "$cmd" -expect { - -ex "aced\\ \\ conf" { pass "$test" } - # _filedir works only if `-o filenames' is in effect, which isn't the - # case for `sftp' - -re "aced conf" { xfail "$test" } - -re $prompt { unresolved "$test at prompt" } - default { unresolved "$test" } -}; # expect -sync_after_int $prompt -assert_bash_exec {cd "$TESTDIR"} +assert_complete "-Fspaced\\ \\ conf" "sftp -Fsp" "-F should complete filename" +sync_after_int teardown diff --git a/test/lib/completions/sh.exp b/test/lib/completions/sh.exp new file mode 100644 index 00000000..e1a51bb9 --- /dev/null +++ b/test/lib/completions/sh.exp @@ -0,0 +1,38 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "sh -" + + +sync_after_int + + +assert_complete_any "sh +" + + +sync_after_int + + +assert_complete_any "sh -o " + + +sync_after_int + + +assert_no_complete "sh -c " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/sha1sum.exp b/test/lib/completions/sha1sum.exp index 17519087..c5983044 100644 --- a/test/lib/completions/sha1sum.exp +++ b/test/lib/completions/sha1sum.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/shar.exp b/test/lib/completions/shar.exp index 7ace9d6e..604a2031 100644 --- a/test/lib/completions/shar.exp +++ b/test/lib/completions/shar.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/sitecopy.exp b/test/lib/completions/sitecopy.exp index 49b78918..7e0c87fe 100644 --- a/test/lib/completions/sitecopy.exp +++ b/test/lib/completions/sitecopy.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/smartctl.exp b/test/lib/completions/smartctl.exp index a9eeb956..24919396 100644 --- a/test/lib/completions/smartctl.exp +++ b/test/lib/completions/smartctl.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/snownews.exp b/test/lib/completions/snownews.exp index 7502e587..c8ad6741 100644 --- a/test/lib/completions/snownews.exp +++ b/test/lib/completions/snownews.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/sort.exp b/test/lib/completions/sort.exp index 20516cc8..a130bbc8 100644 --- a/test/lib/completions/sort.exp +++ b/test/lib/completions/sort.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/split.exp b/test/lib/completions/split.exp index b74da369..e13df49a 100644 --- a/test/lib/completions/split.exp +++ b/test/lib/completions/split.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {split --help} "" "" "unsupported"]} { assert_complete_any "split --" -}; # if +} sync_after_int diff --git a/test/lib/completions/spovray.exp b/test/lib/completions/spovray.exp index 30d81853..2b2c33de 100644 --- a/test/lib/completions/spovray.exp +++ b/test/lib/completions/spovray.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/sqlite3.exp b/test/lib/completions/sqlite3.exp new file mode 100644 index 00000000..af1ada82 --- /dev/null +++ b/test/lib/completions/sqlite3.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "sqlite3 " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ssh.exp b/test/lib/completions/ssh.exp index 91955c1d..1599dccc 100644 --- a/test/lib/completions/ssh.exp +++ b/test/lib/completions/ssh.exp @@ -1,15 +1,19 @@ proc setup {} { save_env -}; # setup() + # NOTE: Changing dir to $SRCDIR is necessary because file locations in the + # ssh config files (e.g. UserKnownHostsFile) are relative to $SRCDIR. + assert_bash_exec {cd $SRCDIR/fixtures/ssh} +} proc teardown {} { + assert_bash_exec {cd $TESTDIR} assert_env_unmodified { /BASH_LINENO=/d /BASH_SOURCE=/d /OLDPWD=/d } -}; # teardown() +} setup @@ -17,19 +21,14 @@ setup set test "Tab should complete both commands and hostname" # Try completion -set dir fixtures/ssh -set prompt "/$dir/@" -assert_bash_exec "cd $dir" "" $prompt set cmd "ssh -F config ls" send "$cmd\t" -set expected "^$cmd\r\n.*ls.*ls_known_host.*\r\n$prompt$cmd$" +set expected "^$cmd\r\n.*ls.*ls_known_host.*\r\n/@$cmd$" expect { -re $expected { pass "$test" } - -re $prompt { unresolved "$test at prompt" } + -re /@ { unresolved "$test at prompt" } default { unresolved "$test" } -}; # expect -sync_after_int $prompt -assert_bash_exec {cd "$TESTDIR"} +} sync_after_int @@ -45,7 +44,7 @@ expect { -re "^$cmd\r\n.*\r\n/@" { pass "$test" } -re /@ { unresolved "$test at prompt" } default { unresolved "$test" } -}; # expect +} sync_after_int @@ -61,30 +60,14 @@ sync_after_int set test "First argument should complete partial hostname" -assert_complete_partial [get_hosts] ssh "" $test /@ 20 \ - [list "ltrim_colon_completions"] +assert_complete_partial [get_hosts] ssh "" $test -ltrim-colon-completions sync_after_int set test "-F should complete filename" -set dir fixtures/ssh -set prompt "/$dir/@" -assert_bash_exec "cd $dir" "" $prompt -set cmd "ssh -Fsp" -send "$cmd\t" -expect -ex "$cmd" -expect { - -ex "aced\\ \\ conf" { pass "$test" } - # _filedir works only if `-o filenames' is in effect, which isn't the - # case for `ssh' - -re "aced conf" { xfail "$test" } - -re $prompt { unresolved "$test at prompt" } - default { unresolved "$test" } -}; # expect -sync_after_int $prompt -assert_bash_exec {cd "$TESTDIR"} +assert_complete "-Fspaced\\ \\ conf" "ssh -Fsp" $test sync_after_int diff --git a/test/lib/completions/sshmitm.exp b/test/lib/completions/sshmitm.exp index b8f8a2c9..13b50673 100644 --- a/test/lib/completions/sshmitm.exp +++ b/test/lib/completions/sshmitm.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/sshow.exp b/test/lib/completions/sshow.exp index 36a6cc2c..074d7b12 100644 --- a/test/lib/completions/sshow.exp +++ b/test/lib/completions/sshow.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/strace.exp b/test/lib/completions/strace.exp index 55004d20..933d1b48 100644 --- a/test/lib/completions/strace.exp +++ b/test/lib/completions/strace.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/strip.exp b/test/lib/completions/strip.exp index 46d9f362..00f4ab9c 100644 --- a/test/lib/completions/strip.exp +++ b/test/lib/completions/strip.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/sudo.exp b/test/lib/completions/sudo.exp index 1299a6da..d6bbbbb6 100644 --- a/test/lib/completions/sudo.exp +++ b/test/lib/completions/sudo.exp @@ -1,17 +1,24 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { - assert_env_unmodified -}; # teardown() + assert_env_unmodified {/OLDPWD/d} +} setup -assert_complete "fixtures/shared/default/foo.d/" "sudo cd fixtures/shared/default/fo" +assert_complete_dir foo.d/ "sudo cd fo" $::srcdir/fixtures/shared/default \ + "" -nospace + + +sync_after_int + + +assert_complete_dir fixtures/ "sudo sh fix" $::srcdir "" -nospace sync_after_int diff --git a/test/lib/completions/svk.exp b/test/lib/completions/svk.exp index a08674dc..a794a008 100644 --- a/test/lib/completions/svk.exp +++ b/test/lib/completions/svk.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/svn.exp b/test/lib/completions/svn.exp index fe40d6f7..d1a08ae4 100644 --- a/test/lib/completions/svn.exp +++ b/test/lib/completions/svn.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/svnadmin.exp b/test/lib/completions/svnadmin.exp index 35e07021..f20d52cf 100644 --- a/test/lib/completions/svnadmin.exp +++ b/test/lib/completions/svnadmin.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/svnlook.exp b/test/lib/completions/svnlook.exp index 33b67052..114435ec 100644 --- a/test/lib/completions/svnlook.exp +++ b/test/lib/completions/svnlook.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/sync_members.exp b/test/lib/completions/sync_members.exp index 4cb84ad8..817432bb 100644 --- a/test/lib/completions/sync_members.exp +++ b/test/lib/completions/sync_members.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/sysbench.exp b/test/lib/completions/sysbench.exp new file mode 100644 index 00000000..2a0fe339 --- /dev/null +++ b/test/lib/completions/sysbench.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "sysbench " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/sysctl.exp b/test/lib/completions/sysctl.exp index e1866f55..6aa9ffe0 100644 --- a/test/lib/completions/sysctl.exp +++ b/test/lib/completions/sysctl.exp @@ -1,19 +1,20 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup if {[assert_exec {sysctl -N -a 2>/dev/null | grep ^kern | sort -u} values]} { - assert_complete $values "sysctl kern" -}; # if + set test "sysctl kern should show completions" + assert_complete $values "sysctl kern" $test -expect-cmd-minus kern +} sync_after_int diff --git a/test/lib/completions/tac.exp b/test/lib/completions/tac.exp index 21230052..d4fe7937 100644 --- a/test/lib/completions/tac.exp +++ b/test/lib/completions/tac.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/tail.exp b/test/lib/completions/tail.exp index c8a82d97..fd685b1a 100644 --- a/test/lib/completions/tail.exp +++ b/test/lib/completions/tail.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {tail --help} "" "" "unsupported"]} { assert_complete_any "tail --" -}; # if +} sync_after_int diff --git a/test/lib/completions/tar.exp b/test/lib/completions/tar.exp index 43c60ff9..37f1ae4b 100644 --- a/test/lib/completions/tar.exp +++ b/test/lib/completions/tar.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/tcpkill.exp b/test/lib/completions/tcpkill.exp index e8cc9c10..d3a45e43 100644 --- a/test/lib/completions/tcpkill.exp +++ b/test/lib/completions/tcpkill.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/tcpnice.exp b/test/lib/completions/tcpnice.exp index 44bb59c6..b4b93097 100644 --- a/test/lib/completions/tcpnice.exp +++ b/test/lib/completions/tcpnice.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/tee.exp b/test/lib/completions/tee.exp index c25057ba..1058bb8e 100644 --- a/test/lib/completions/tee.exp +++ b/test/lib/completions/tee.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/texindex.exp b/test/lib/completions/texindex.exp index d5b8cd77..43b4c09a 100644 --- a/test/lib/completions/texindex.exp +++ b/test/lib/completions/texindex.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/tightvncviewer.exp b/test/lib/completions/tightvncviewer.exp index 6eba24c2..ee987f60 100644 --- a/test/lib/completions/tightvncviewer.exp +++ b/test/lib/completions/tightvncviewer.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/time.exp b/test/lib/completions/time.exp index b114318b..3bed4fdf 100644 --- a/test/lib/completions/time.exp +++ b/test/lib/completions/time.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/touch.exp b/test/lib/completions/touch.exp index f0960ef7..61d22b33 100644 --- a/test/lib/completions/touch.exp +++ b/test/lib/completions/touch.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {touch --help} "" "" "unsupported"]} { assert_complete_any "touch --" -}; # if +} sync_after_int diff --git a/test/lib/completions/tr.exp b/test/lib/completions/tr.exp index 68b11a36..c10c8ba1 100644 --- a/test/lib/completions/tr.exp +++ b/test/lib/completions/tr.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {tr --help} "" "" "unsupported"]} { assert_complete_any "tr --" -}; # if +} sync_after_int diff --git a/test/lib/completions/tune2fs.exp b/test/lib/completions/tune2fs.exp new file mode 100644 index 00000000..df70d904 --- /dev/null +++ b/test/lib/completions/tune2fs.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "tune2fs " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/unace.exp b/test/lib/completions/unace.exp index 0afbaafb..c9d7606e 100644 --- a/test/lib/completions/unace.exp +++ b/test/lib/completions/unace.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/uname.exp b/test/lib/completions/uname.exp index 2179dafd..0c363ab5 100644 --- a/test/lib/completions/uname.exp +++ b/test/lib/completions/uname.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {uname --help} "" "" "unsupported"]} { assert_complete_any "uname --" -}; # if +} sync_after_int diff --git a/test/lib/completions/unexpand.exp b/test/lib/completions/unexpand.exp index 31822561..c9aecc25 100644 --- a/test/lib/completions/unexpand.exp +++ b/test/lib/completions/unexpand.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {unexpand --help} "" "" "unsupported"]} { assert_complete_any "unexpand --" -}; # if +} sync_after_int diff --git a/test/lib/completions/uniq.exp b/test/lib/completions/uniq.exp index 20dbcfac..d516106c 100644 --- a/test/lib/completions/uniq.exp +++ b/test/lib/completions/uniq.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {uniq --help} "" "" "unsupported"]} { assert_complete_any "uniq --" -}; # if +} sync_after_int diff --git a/test/lib/completions/units.exp b/test/lib/completions/units.exp index a40b5f3f..96ec91d1 100644 --- a/test/lib/completions/units.exp +++ b/test/lib/completions/units.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {units --help} "" "" "unsupported"]} { assert_complete_any "units --" -}; # if +} sync_after_int diff --git a/test/lib/completions/unpack200.exp b/test/lib/completions/unpack200.exp index 845701dd..b4360491 100644 --- a/test/lib/completions/unpack200.exp +++ b/test/lib/completions/unpack200.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/unrar.exp b/test/lib/completions/unrar.exp index e66e3c8b..b5e27b21 100644 --- a/test/lib/completions/unrar.exp +++ b/test/lib/completions/unrar.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/unset.exp b/test/lib/completions/unset.exp index a5e7fc9b..42e753cb 100644 --- a/test/lib/completions/unset.exp +++ b/test/lib/completions/unset.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/unshunt.exp b/test/lib/completions/unshunt.exp index 964cac68..96cd5860 100644 --- a/test/lib/completions/unshunt.exp +++ b/test/lib/completions/unshunt.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/update-alternatives.exp b/test/lib/completions/update-alternatives.exp index 10ff4e6d..b94d88c5 100644 --- a/test/lib/completions/update-alternatives.exp +++ b/test/lib/completions/update-alternatives.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/update-rc.d.exp b/test/lib/completions/update-rc.d.exp index 9c2c2464..f2eafea5 100644 --- a/test/lib/completions/update-rc.d.exp +++ b/test/lib/completions/update-rc.d.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/urlsnarf.exp b/test/lib/completions/urlsnarf.exp index c5b26922..ed543629 100644 --- a/test/lib/completions/urlsnarf.exp +++ b/test/lib/completions/urlsnarf.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vdir.exp b/test/lib/completions/vdir.exp index b525c382..c0e5ee43 100644 --- a/test/lib/completions/vdir.exp +++ b/test/lib/completions/vdir.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgcfgbackup.exp b/test/lib/completions/vgcfgbackup.exp index 19ceeeca..b7e509a2 100644 --- a/test/lib/completions/vgcfgbackup.exp +++ b/test/lib/completions/vgcfgbackup.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgcfgrestore.exp b/test/lib/completions/vgcfgrestore.exp index e1c3c3b9..e40cd213 100644 --- a/test/lib/completions/vgcfgrestore.exp +++ b/test/lib/completions/vgcfgrestore.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgchange.exp b/test/lib/completions/vgchange.exp index 645eedb4..b6c0e1df 100644 --- a/test/lib/completions/vgchange.exp +++ b/test/lib/completions/vgchange.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgck.exp b/test/lib/completions/vgck.exp index 67209b15..b4d58aec 100644 --- a/test/lib/completions/vgck.exp +++ b/test/lib/completions/vgck.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgconvert.exp b/test/lib/completions/vgconvert.exp index 065c4828..362c44b6 100644 --- a/test/lib/completions/vgconvert.exp +++ b/test/lib/completions/vgconvert.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgcreate.exp b/test/lib/completions/vgcreate.exp index 7c324e62..4cb7dd45 100644 --- a/test/lib/completions/vgcreate.exp +++ b/test/lib/completions/vgcreate.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgdisplay.exp b/test/lib/completions/vgdisplay.exp index b6bc9125..6a8ed84d 100644 --- a/test/lib/completions/vgdisplay.exp +++ b/test/lib/completions/vgdisplay.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgexport.exp b/test/lib/completions/vgexport.exp index 2ad4230e..2900960f 100644 --- a/test/lib/completions/vgexport.exp +++ b/test/lib/completions/vgexport.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgextend.exp b/test/lib/completions/vgextend.exp index 18a491d2..3c46a8f0 100644 --- a/test/lib/completions/vgextend.exp +++ b/test/lib/completions/vgextend.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgimport.exp b/test/lib/completions/vgimport.exp index e4568f3b..ed04e282 100644 --- a/test/lib/completions/vgimport.exp +++ b/test/lib/completions/vgimport.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgmerge.exp b/test/lib/completions/vgmerge.exp index 8ba5e893..a4f8833b 100644 --- a/test/lib/completions/vgmerge.exp +++ b/test/lib/completions/vgmerge.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgmknodes.exp b/test/lib/completions/vgmknodes.exp index d24552f0..5c9feeb3 100644 --- a/test/lib/completions/vgmknodes.exp +++ b/test/lib/completions/vgmknodes.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgreduce.exp b/test/lib/completions/vgreduce.exp index 887ba8de..f6af3150 100644 --- a/test/lib/completions/vgreduce.exp +++ b/test/lib/completions/vgreduce.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgremove.exp b/test/lib/completions/vgremove.exp index 26dadf95..0dc5eda8 100644 --- a/test/lib/completions/vgremove.exp +++ b/test/lib/completions/vgremove.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgrename.exp b/test/lib/completions/vgrename.exp index 8ddaa758..81438631 100644 --- a/test/lib/completions/vgrename.exp +++ b/test/lib/completions/vgrename.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgs.exp b/test/lib/completions/vgs.exp index a27e3650..22ab176b 100644 --- a/test/lib/completions/vgs.exp +++ b/test/lib/completions/vgs.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgscan.exp b/test/lib/completions/vgscan.exp index 4bb8c35e..ae8168c8 100644 --- a/test/lib/completions/vgscan.exp +++ b/test/lib/completions/vgscan.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vgsplit.exp b/test/lib/completions/vgsplit.exp index 54e7034f..b183cfda 100644 --- a/test/lib/completions/vgsplit.exp +++ b/test/lib/completions/vgsplit.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/vncviewer.exp b/test/lib/completions/vncviewer.exp index 3d47f49f..8c51e0b2 100644 --- a/test/lib/completions/vncviewer.exp +++ b/test/lib/completions/vncviewer.exp @@ -1,13 +1,13 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified { /declare -f _vncviewer_bootstrap/d } -}; # teardown() +} setup diff --git a/test/lib/completions/wc.exp b/test/lib/completions/wc.exp index 8ad2bf8d..b261b6a7 100644 --- a/test/lib/completions/wc.exp +++ b/test/lib/completions/wc.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {wc --help} "" "" "unsupported"]} { assert_complete_any "wc --" -}; # if +} sync_after_int diff --git a/test/lib/completions/webmitm.exp b/test/lib/completions/webmitm.exp index 1d48a3a6..adb97cc2 100644 --- a/test/lib/completions/webmitm.exp +++ b/test/lib/completions/webmitm.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/wget.exp b/test/lib/completions/wget.exp index 245b27be..8e830a12 100644 --- a/test/lib/completions/wget.exp +++ b/test/lib/completions/wget.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/who.exp b/test/lib/completions/who.exp index 73928ef7..6cca6795 100644 --- a/test/lib/completions/who.exp +++ b/test/lib/completions/who.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup @@ -13,7 +13,7 @@ setup if {[assert_exec {who --help} "" "" "unsupported"]} { assert_complete_any "who --" -}; # if +} sync_after_int diff --git a/test/lib/completions/withlist.exp b/test/lib/completions/withlist.exp index 6310466d..e1f91f6a 100644 --- a/test/lib/completions/withlist.exp +++ b/test/lib/completions/withlist.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/wol.exp b/test/lib/completions/wol.exp index 84a2d88d..a4ac9e4e 100644 --- a/test/lib/completions/wol.exp +++ b/test/lib/completions/wol.exp @@ -1,14 +1,14 @@ proc setup {} { # See fixtures/shared/bin/{arp,ifconfig} - assert_bash_exec {OLDPATH="$PATH"; PATH="$TESTDIR/fixtures/shared/bin:$PATH";} + assert_bash_exec {OLDPATH="$PATH"; PATH="$SRCDIR/fixtures/shared/bin:$PATH";} save_env -}; # setup() +} proc teardown {} { assert_env_unmodified assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} -}; # teardown() +} setup diff --git a/test/lib/completions/wtf.exp b/test/lib/completions/wtf.exp index 8250becc..b1693c80 100644 --- a/test/lib/completions/wtf.exp +++ b/test/lib/completions/wtf.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/wvdial.exp b/test/lib/completions/wvdial.exp index 8d4669de..5b52daa8 100644 --- a/test/lib/completions/wvdial.exp +++ b/test/lib/completions/wvdial.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/xfreerdp.exp b/test/lib/completions/xfreerdp.exp new file mode 100644 index 00000000..f61cfcad --- /dev/null +++ b/test/lib/completions/xfreerdp.exp @@ -0,0 +1,28 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +set test "Tab should complete options" +set cmd "xfreerdp --" +send "$cmd\t" +set expected "^$cmd\r\n--data.*--kbd-list.*--plugin\r\n/@$cmd$" +expect { + -re $expected { pass "$test" } + -re /@ { unresolved "$test at prompt" } + default { unresolved "$test" } +} + + +sync_after_int + + +teardown diff --git a/test/lib/completions/xhost.exp b/test/lib/completions/xhost.exp index aeceadb6..82e2e9c6 100644 --- a/test/lib/completions/xhost.exp +++ b/test/lib/completions/xhost.exp @@ -1,24 +1,19 @@ proc setup {} { assert_bash_exec {HOME=$TESTDIR} save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup set test "Tab should complete hostnames" - # Build string list of hostnames -set hosts {} -foreach h [exec bash -c "compgen -A hostname"] { - lappend hosts $h -}; # foreach -assert_complete $hosts "xhost " $test +assert_complete [get_hosts] "xhost " $test sync_after_int @@ -28,13 +23,13 @@ set test "Tab should complete partial hostname" # Build string list of hostnames, starting with the character of the first hostname set hosts {} set char "" -foreach h [exec bash -c "compgen -A hostname"] { +foreach h [get_hosts] { if {$char == ""} {set char [string range $h 0 0]} # Only append hostname if starting with $char if {[string range $h 0 0] == "$char"} { lappend hosts $h - }; # if -}; # foreach + } +} assert_complete $hosts "xhost $char" $test @@ -44,9 +39,9 @@ sync_after_int set test "Tab should complete hostnames prefixed with +" # Build string list of hostnames, prefixed with plus (+) set hosts {} -foreach h [exec bash -c "compgen -A hostname"] { +foreach h [get_hosts] { lappend hosts "+$h" -}; # foreach +} assert_complete $hosts "xhost \+" $test @@ -56,13 +51,13 @@ sync_after_int set test "Tab should complete partial hostname prefixed with +" # Build string list of hostnames, starting with character of first host. set hosts {} -foreach h [exec bash -c "compgen -A hostname"] { +foreach h [get_hosts] { if {$char == ""} {set char [string range $h 0 0]} # Only append hostname if starting with $char if {[string range $h 0 0] == "$char"} { lappend hosts "+$h" - }; # if -}; # foreach + } +} assert_complete $hosts "xhost +$char" @@ -72,9 +67,9 @@ sync_after_int set test "Tab should complete hostnames prefixed with -" # Build string list of hostnames, prefix with minus (-) set hosts {} -foreach h [exec bash -c "compgen -A hostname"] { +foreach h [get_hosts] { lappend hosts "-$h" -}; # foreach +} assert_complete $hosts "xhost -" $test @@ -84,13 +79,13 @@ sync_after_int set test "Tab should complete partial hostname prefixed with -" # Build list of hostnames, starting with character of first host set hosts {} -foreach h [exec bash -c "compgen -A hostname"] { +foreach h [get_hosts] { if {$char == ""} {set char [string range $h 0 0]} # Only append hostname if starting with $char if {[string range $h 0 0] == "$char"} { lappend hosts "-$h" - }; # if -}; # foreach + } +} assert_complete $hosts "xhost -$char" $test diff --git a/test/lib/completions/xmllint.exp b/test/lib/completions/xmllint.exp index 15451471..20daab6d 100644 --- a/test/lib/completions/xmllint.exp +++ b/test/lib/completions/xmllint.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/xmlwf.exp b/test/lib/completions/xmlwf.exp index a996d458..6c306f34 100644 --- a/test/lib/completions/xmlwf.exp +++ b/test/lib/completions/xmlwf.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/xmms.exp b/test/lib/completions/xmms.exp index c4ad64e8..1f1f6d57 100644 --- a/test/lib/completions/xmms.exp +++ b/test/lib/completions/xmms.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/xmodmap.exp b/test/lib/completions/xmodmap.exp new file mode 100644 index 00000000..2bf4da1c --- /dev/null +++ b/test/lib/completions/xmodmap.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "xmodmap " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/xpovray.exp b/test/lib/completions/xpovray.exp index 92cc903d..53a5fcd0 100644 --- a/test/lib/completions/xpovray.exp +++ b/test/lib/completions/xpovray.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/xrandr.exp b/test/lib/completions/xrandr.exp index 649ed43b..14beb762 100644 --- a/test/lib/completions/xrandr.exp +++ b/test/lib/completions/xrandr.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/xrdb.exp b/test/lib/completions/xrdb.exp new file mode 100644 index 00000000..f02625dc --- /dev/null +++ b/test/lib/completions/xrdb.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "xrdb " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/xsltproc.exp b/test/lib/completions/xsltproc.exp index 2470c22e..2c558ff1 100644 --- a/test/lib/completions/xsltproc.exp +++ b/test/lib/completions/xsltproc.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/xvnc4viewer.exp b/test/lib/completions/xvnc4viewer.exp index 3456c3e7..b10e272c 100644 --- a/test/lib/completions/xvnc4viewer.exp +++ b/test/lib/completions/xvnc4viewer.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/xz.exp b/test/lib/completions/xz.exp index 820b0689..6e6b29ca 100644 --- a/test/lib/completions/xz.exp +++ b/test/lib/completions/xz.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { - assert_env_unmodified -}; # teardown() + assert_env_unmodified {/OLDPWD=/d} +} setup @@ -17,14 +17,14 @@ assert_complete_any "xz " sync_after_int -assert_complete "a/ bashcomp.lzma bashcomp.tar.xz bashcomp.tlz bashcomp.xz" \ - "xz -d fixtures/xz/" +assert_complete_dir "a/ bashcomp.lzma bashcomp.tar.xz bashcomp.tlz bashcomp.xz" \ + "xz -d " $::srcdir/fixtures/xz sync_after_int -assert_complete "a/ bashcomp.tar" "xz fixtures/xz/" +assert_complete_dir "a/ bashcomp.tar" "xz " $::srcdir/fixtures/xz sync_after_int diff --git a/test/lib/completions/ypcat.exp b/test/lib/completions/ypcat.exp index f1bd0c0e..a8249dc2 100644 --- a/test/lib/completions/ypcat.exp +++ b/test/lib/completions/ypcat.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/ypmatch.exp b/test/lib/completions/ypmatch.exp index f1695f67..ac264c18 100644 --- a/test/lib/completions/ypmatch.exp +++ b/test/lib/completions/ypmatch.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/yum-arch.exp b/test/lib/completions/yum-arch.exp index defb7bf4..85c47c22 100644 --- a/test/lib/completions/yum-arch.exp +++ b/test/lib/completions/yum-arch.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/completions/yum.exp b/test/lib/completions/yum.exp index 09d7282c..899ecddb 100644 --- a/test/lib/completions/yum.exp +++ b/test/lib/completions/yum.exp @@ -1,11 +1,11 @@ proc setup {} { save_env -}; # setup() +} proc teardown {} { assert_env_unmodified -}; # teardown() +} setup diff --git a/test/lib/library.exp b/test/lib/library.exp index c76d9854..491da212 100644 --- a/test/lib/library.exp +++ b/test/lib/library.exp @@ -1,7 +1,8 @@ - # Source `init.tcl' again to restore the `unknown' procedure - # NOTE: DejaGnu has an old `unknown' procedure which unfortunately disables - # tcl auto-loading. +# Source `init.tcl' again to restore the `unknown' procedure +# NOTE: DejaGnu has an old `unknown' procedure which unfortunately disables +# tcl auto-loading. source [file join [info library] init.tcl] +package require cmdline package require textutil::string @@ -22,7 +23,7 @@ proc assert_bash_exec {{aCmd ""} {title ""} {prompt /@} {out -1}} { if {[string length $aCmd] != 0} { send "$aCmd\r" expect -ex "$aCmd\r\n" - }; # if + } if {[string length $title] == 0} {set title $aCmd} expect -ex $prompt set results $expect_out(buffer); # Catch output @@ -33,24 +34,16 @@ proc assert_bash_exec {{aCmd ""} {title ""} {prompt /@} {out -1}} { ] ] if {$out == -1 && [string length $results] > 0} { - if {[info exists multipass_name]} { - fail "ERROR Unexpected output from bash command \"$title\"" - }; # if - send_user "ERROR Unexpected output from bash command \"$title\":\n$results" - }; # if + fail "ERROR Unexpected output from bash command \"$title\"" + } set cmd "echo $?" send "$cmd\r" expect { -ex "$cmd\r\n0\r\n$prompt" {} - $prompt { - if {[info exists multipass_name]} { - fail "ERROR executing bash command \"$title\"" - }; # if - send_user "ERROR executing bash command \"$title\"" - } - }; # expect -}; # assert_bash_exec() + $prompt {fail "ERROR executing bash command \"$title\""} + } +} # Test `type ...' in bash @@ -64,32 +57,45 @@ proc assert_bash_type {command} { expect { -ex 0 { set result true } -ex 1 { set result false; unsupported "$test" } - }; # expect + } expect "/@" return $result -}; # assert_bash_type() +} -# Make sure the expected list is returned by executing the specified command. -# @param list $expected -# @param string $cmd Command given to generate items -# @param string $test (optional) Test title. Default is "$cmd<TAB> should show completions" -# @param string $prompt (optional) Bash prompt. Default is "/@" -# @param integer $size (optional) Chunk size. Default is 20. -# @result boolean True if successful, False if not -proc assert_bash_list {expected cmd {test ""} {prompt /@} {size 20}} { +# Make sure the expected list matches the real list, as returned by executing +# the specified bash command. +# Specify `-sort' if the real list is sorted. +# @param list $expected Expected list items +# @param string $cmd Bash command to execute in order to generate real list +# items +# @param string $test Test title. Becomes "$cmd should show expected output" +# if empty string. +# @param list $args Options: +# -sort Compare list sorted. Default is unsorted +# -prompt Bash prompt. Default is `/@' +# -chunk-size N Compare list N items at a time. Default +# is 20. +proc assert_bash_list {expected cmd test {args {}}} { + array set arg [::cmdline::getoptions args { + {sort "compare list sorted"} + {prompt.arg /@ "bash prompt"} + {chunk-size.arg 20 "compare N list items at a time"} + }] + set prompt $arg(prompt) if {$test == ""} {set test "$cmd should show expected output"} if {[llength $expected] == 0} { assert_no_output $cmd $test $prompt } else { send "$cmd\r" expect -ex "$cmd\r\n" - - if {[match_items $expected $test $prompt $size]} { - expect { - -re $prompt { pass "$test" } - -re eof { unresolved "eof" } - } + if {$arg(sort)} {set bash_sort "-bash-sort"} {set bash_sort ""} + if {[ + eval match_items \$expected $bash_sort -chunk-size \ + \$arg(chunk-size) -end-newline -end-prompt \ + -prompt \$prompt + ]} { + pass "$test" } else { fail "$test" } @@ -97,130 +103,235 @@ proc assert_bash_list {expected cmd {test ""} {prompt /@} {size 20}} { } -proc assert_bash_list_dir {expected cmd dir {test ""} {prompt /@} {size 20}} { - set prompt "/$dir/@" +# Make sure the expected list matches the real list, as returned by executing +# the specified bash command within the specified directory. +# Specify `-sort' if the real list is sorted. +# @param list $expected Expected list items +# @param string $cmd Bash command to generate real list items +# @param string $dir Directory to execute $cmd within +# @param string $test Test title. Becomes "$cmd should show expected output" +# if empty string. +# @param list $args Options: +# -sort Compare list sorted. Default is unsorted +# -prompt Bash prompt. Default is `/@' +# -chunk-size N Compare list N items at a time. Default +# is 20. +proc assert_bash_list_dir {expected cmd dir test {args {}}} { + array set arg [::cmdline::getoptions args { + {sort "compare list sorted"} + {prompt.arg "/@" "bash prompt"} + {chunk-size.arg 20 "compare N list items at a time"} + }] + set prompt $arg(prompt) + if {$arg(sort)} {set arg_sort "-sort"} else {set arg_sort ""} assert_bash_exec "cd $dir" "" $prompt - assert_bash_list $expected $cmd $test $prompt $size + assert_bash_list $expected $cmd $test $arg_sort \ + -chunk-size $arg(chunk-size) -prompt $prompt sync_after_int $prompt assert_bash_exec {cd "$TESTDIR"} -}; # assert_bash_list_dir() +} # Make sure the expected items are returned by TAB-completing the specified -# command. +# command. If the number of expected items is one, expected is: +# +# $cmd<TAB>$expected[<SPACE>] +# +# SPACE is not expected if -nospace is specified. +# +# If the number of expected items is greater than one, expected is: +# +# $cmd<TAB>\n +# $expected\n +# $prompt + ($cmd - AUTO) + longest-common-prefix-of-$expected +# +# AUTO is calculated like this: If $cmd ends with non-whitespace, and +# the last argument of $cmd equals the longest-common-prefix of +# $expected, $cmd minus this argument will be expected. +# +# If the algorithm above fails, you can manually specify the CWORD to be +# subtracted from $cmd specifying `-expect-cmd-minus CWORD'. Known cases where +# this is useful are when: +# - the last whitespace is escaped, e.g. "finger foo\ " or "finger +# 'foo " +# +# If the entire $cmd is expected, specify `-expect-cmd-full'. +# # @param list $expected Expected completions. # @param string $cmd Command given to generate items -# @param string $test (optional) Test title. Default is "$cmd<TAB> should show completions" -# @param string $prompt (optional) Bash prompt. Default is "/@" -# @param integer $size (optional) Chunk size. Default is 20. -# @param string $cword (optional) Last argument of $cmd which is an -# argument-to-complete and to be replaced with the longest common prefix -# of $expected. If empty string (default), `assert_complete' autodetects -# if the last argument is an argument-to-complete by checking if $cmd -# doesn't end with whitespace. Specifying `cword' should only be necessary -# if this autodetection fails, e.g. when the last whitespace is escaped or -# quoted, e.g. "finger foo\ " or "finger 'foo " -# @param list $filters (optional) List of filters to apply to this function to tweak -# the expected completions and argument-to-complete. Possible values: -# - "ltrim_colon_completions" -# @result boolean True if successful, False if not -proc assert_complete {expected cmd {test ""} {prompt /@} {size 20} {cword ""} {filters ""}} { +# @param string $test Test title +# @param list $args Options: +# -prompt PROMPT Bash prompt. Default is `/@' +# -chunk-size CHUNK-SIZE Compare list CHUNK-SIZE items at +# a time. Default is 20. +# -nospace Don't expect space character to be output after completion match. +# Valid only if a single completion is expected. +# -ltrim-colon-completions Left-trim completions with cword containing +# colon (:) +# -expect-cmd-full Expect the full $cmd to be echoed. Expected is: +# +# $cmd<TAB>\n +# $expected\n +# $prompt + $cmd + longest-common-prefix-of-$expected +# +# -expect-cmd-minus DWORD Expect $cmd minus DWORD to be echoed. +# Expected is: +# +# $cmd<TAB>\n +# $expected\n +# $prompt + ($cmd - DWORD) + longest-common-prefix-of-$expected +# +proc assert_complete {expected cmd {test ""} {args {}}} { + set args_orig $args + array set arg [::cmdline::getoptions args { + {prompt.arg "/@" "bash prompt"} + {chunk-size.arg 20 "compare N list items at a time"} + {nospace "don't expect space after completion"} + {ltrim-colon-completions "left-trim completions with cword containing :"} + {expect-cmd-full "Expect full cmd after prompt"} + {expect-cmd-minus.arg "" "Expect cmd minus DWORD after prompt"} + }] if {[llength $expected] == 0} { assert_no_complete $cmd $test + } elseif {[llength $expected] == 1} { + eval assert_complete_one \$expected \$cmd \$test $args_orig } else { - if {$test == ""} {set test "$cmd should show completions"} - send "$cmd\t" - if {[llength $expected] == 1} { - expect -ex "$cmd" - - if {[lsearch -exact $filters "ltrim_colon_completions"] == -1} { - set cur ""; # Default to empty word to complete on - set words [split_words_bash $cmd] - if {[llength $words] > 1} { - # Assume last word of `$cmd' is word to complete on. - set index [expr [llength $words] - 1] - set cur [lindex $words $index] - }; # if - # Remove second word from beginning of single item $expected - if {[string first $cur $expected] == 0} { - set expected [list [string range $expected [string length $cur] end]] - }; # if - }; # if - } else { - expect -ex "$cmd\r\n" - # Make sure expected items are unique - set expected [lsort -unique $expected] - }; # if - - if {[lsearch -exact $filters "ltrim_colon_completions"] != -1} { - # If partial contains colon (:), remove partial from begin of items - # See also: bash_completion.__ltrim_colon_completions() - _ltrim_colon_completions cword expected - }; # if - - if {[match_items $expected $test $prompt $size]} { - if {[llength $expected] == 1} { - pass "$test" - } else { - # Remove optional (partial) last argument-to-complete from `cmd', - # E.g. "finger test@" becomes "finger" - - if {[lsearch -exact $filters "ltrim_colon_completions"] != -1} { - set cmd2 $cmd - } else { - set cmd2 [_remove_cword_from_cmd $cmd $cword] - }; # if - - # Determine common prefix of completions - set common [::textutil::string::longestCommonPrefixList $expected] - #if {[string length $common] > 0} {set common " $common"} - expect { - -ex "$prompt$cmd2$common" { pass "$test" } - -re $prompt { unresolved "$test at prompt" } - -re eof { unresolved "eof" } - }; # expect - }; # if - } else { - fail "$test" - }; # if - }; # if -}; # assert_complete() + eval assert_complete_many \$expected \$cmd \$test $args_orig + } +} + + +# Make sure the expected multiple items are returned by TAB-completing the +# specified command. +# @see assert_complete() +proc assert_complete_many {expected cmd {test ""} {args {}}} { + array set arg [::cmdline::getoptions args { + {prompt.arg "/@" "bash prompt"} + {chunk-size.arg 20 "compare N list items at a time"} + {nospace "don't expect space after completion"} + {ltrim-colon-completions "left-trim completions with cword containing :"} + {expect-cmd-full "Expect full cmd after prompt"} + {expect-cmd-minus.arg "" "Expect cmd minus CWORD after prompt"} + }] + if {$test == ""} {set test "$cmd should show completions"} + set prompt $arg(prompt) + set dword "" + if {$arg(expect-cmd-minus) != ""} {set dword $arg(expect-cmd-minus)} + + send "$cmd\t" + expect -ex "$cmd\r\n" + # Make sure expected items are unique + set expected [lsort -unique $expected] -# @param string $cmd Command to remove cword from -# @param string $cword (optional) Last argument of $cmd which is an -# argument-to-complete and to be deleted. If empty string (default), -# `_remove_cword_from_cmd' autodetects if the last argument is an -# argument-to-complete by checking if $cmd doesn't end with whitespace. -# Specifying `cword' is only necessary if this autodetection fails, e.g. + # Determine common prefix of completions + set common [::textutil::string::longestCommonPrefixList $expected] + + if {$arg(ltrim-colon-completions)} { + # If partial contains colon (:), remove partial from begin of items + _ltrim_colon_completions $cmd expected dword + } + set cmd2 [_remove_cword_from_cmd $cmd $dword $common] + + set prompt "$prompt$cmd2$common" + if {$arg(nospace)} {set endspace ""} else {set endspace "-end-space"} + set endprompt "-end-prompt" + if {[ + eval match_items \$expected -bash-sort -chunk-size \ + \$arg(chunk-size) $endprompt $endspace -prompt \$prompt + ]} { + pass "$test" + } else { + fail "$test" + } +} + + +# Make sure the expected single item is returned by TAB-completing the +# specified command. +# @see assert_complete() +proc assert_complete_one {expected cmd {test ""} {args {}}} { + array set arg [::cmdline::getoptions args { + {prompt.arg "/@" "bash prompt"} + {chunk-size.arg 20 "compare N list items at a time"} + {nospace "don't expect space after completion"} + {ltrim-colon-completions "left-trim completions with cword containing :"} + {expect-cmd-full "Expect full cmd after prompt"} + {expect-cmd-minus.arg "" "Expect cmd minus CWORD after prompt"} + }] + set prompt $arg(prompt) + + if {$test == ""} {set test "$cmd should show completion"} + send "$cmd\t" + expect -ex "$cmd" + if {$arg(ltrim-colon-completions)} { + # If partial contains colon (:), remove partial from begin of items + _ltrim_colon_completions $cmd expected cword + } else { + set cur ""; # Default to empty word to complete on + set words [split_words_bash $cmd] + if {[llength $words] > 1} { + # Assume last word of `$cmd' is word to complete on. + set index [expr [llength $words] - 1] + set cur [lindex $words $index] + } + # Remove second word from beginning of $expected + if {[string first $cur $expected] == 0} { + set expected [list [string range $expected [string length $cur] end]] + } + } + + if {$arg(nospace)} {set endspace ""} else {set endspace "-end-space"} + if {[ + eval match_items \$expected -bash-sort -chunk-size \ + \$arg(chunk-size) $endspace -prompt \$prompt + ]} { + pass "$test" + } else { + fail "$test" + } +} + + +# @param string $cmd Command to remove current-word-to-complete from. +# @param string $dword (optional) Manually specify current-word-to-complete, +# i.e. word to remove from $cmd. If empty string (default), +# `_remove_cword_from_cmd' autodetects if the last argument is the +# current-word-to-complete by checking if $cmd doesn't end with whitespace. +# Specifying `dword' is only necessary if this autodetection fails, e.g. # when the last whitespace is escaped or quoted, e.g. "finger foo\ " or # "finger 'foo " -# @return string Command with cword removed -proc _remove_cword_from_cmd {cmd {cword ""}} { +# @param string $common (optional) Common prefix of expected completions. +# @return string Command with current-word-to-complete removed +proc _remove_cword_from_cmd {cmd {dword ""} {common ""}} { set cmd2 $cmd - # Is $cword specified? - if {[string length $cword] > 0} { - # Remove $cword from end of $cmd - if {[string last $cword $cmd] == [string length $cmd] - [string length $cword]} { - set cmd2 [string range $cmd 0 [expr [string last $cword $cmd] - 1]] - }; # if + # Is $dword specified? + if {[string length $dword] > 0} { + # Remove $dword from end of $cmd + if {[string last $dword $cmd] == [string length $cmd] - [string length $dword]} { + set cmd2 [string range $cmd 0 [expr [string last $dword $cmd] - 1]] + } } else { - # No, $cword not specified; - # Check if last argument is really an-argument-to-complete, i.e. + # No, $dword not specified; + # Check if last argument is really a word-to-complete, i.e. # doesn't end with whitespace. # NOTE: This check fails if trailing whitespace is escaped or quoted, # e.g. "finger foo\ " or "finger 'foo ". Specify parameter - # $cword in those cases. + # $dword in those cases. # Is last char whitespace? if {! [string is space [string range $cmd end end]]} { # No, last char isn't whitespace; - # Remove argument-to-complete from end of $cmd - set cmd2 [lrange [split $cmd] 0 end-1] - append cmd2 " " - }; # if - }; # if + set cmds [split $cmd] + # Does word-to-complete start with $common? + if {[string first $common [lrange $cmds end end]] == 0} { + # Remove word-to-complete from end of $cmd + set cmd2 [lrange $cmds 0 end-1] + append cmd2 " " + } + } + } return $cmd2 -}; # _remove_cword_from_cmd() +} # Escape regexp special characters @@ -253,8 +364,8 @@ proc assert_complete_any {cmd {test ""} {prompt /@}} { } -re $prompt { unresolved "$test at prompt" } eof { unresolved "eof" } - }; # expect -}; # assert_complete_any() + } +} # Make sure the expected files are returned by TAB-completing the @@ -262,18 +373,16 @@ proc assert_complete_any {cmd {test ""} {prompt /@}} { # @param list $expected # @param string $cmd Command given to generate items # @param string $dir Subdirectory to attempt completion in. The directory must be relative from the $TESTDIR and without a trailing slash. E.g. `fixtures/evince' -# @param string $test (optional) Test title. Default is "$cmd<TAB> should show completions" -# @param string $prompt (optional) Bash prompt. Default is "/@" -# @param integer $size (optional) Chunk size. Default is 20. -# @param string $cword (optional) Last word of $cmd to complete. See: assert_complete() +# @param string $test Test title +# @param list $args See: assert_complete() # @result boolean True if successful, False if not -proc assert_complete_dir {expected cmd dir {test ""} {size 20} {cword ""}} { - set prompt "/$dir/@" +proc assert_complete_dir {expected cmd dir {test ""} {args {}}} { + set prompt "/@" assert_bash_exec "cd $dir" "" $prompt - assert_complete $expected $cmd $test $prompt $size $cword + assert_complete $expected $cmd $test $args sync_after_int $prompt assert_bash_exec {cd "$TESTDIR"} -}; # assert_complete_dir +} @@ -284,14 +393,9 @@ proc assert_complete_dir {expected cmd dir {test ""} {size 20} {cword ""}} { # @param list $expected List of all completions. # @param string $cmd Command given to generate items # @param string $partial Word to complete -# @param string $test (optional) Test title. Default is "$cmd<TAB> should show completions" -# @param string $prompt (optional) Bash prompt. Default is "/@" -# @param integer $size (optional) Chunk size. Default is 20. -# @param list $filters (optional) List of filters to apply to this function to tweak -# the expected completions and argument-to-complete. -# @see assert_complete() -# @result boolean True if successful, False if not -proc assert_complete_partial {expected cmd {partial ""} {test ""} {prompt /@} {size 20} {filters ""}} { +# @param string $test Test title +# @param list $args See: assert_complete() +proc assert_complete_partial {expected cmd {partial ""} {test ""} {args {}}} { if {$test == ""} {set test "$cmd should complete partial argument"} if {[llength $expected] == 0} { unresolved "$test" @@ -301,39 +405,54 @@ proc assert_complete_partial {expected cmd {partial ""} {test ""} {prompt /@} {s set expected [lsort -unique $expected] foreach item $expected { if {$partial == ""} {set partial [string range $item 0 0]} - # Only append item if starting with $partial + # Only append item if starting with $partial if {[string range $item 0 [expr [string length $partial] - 1]] == "$partial"} { lappend pick $item - }; # if - }; # foreach - assert_complete $pick "$cmd $partial" $test $prompt $size $partial $filters - }; # if -}; # assert_complete_partial() + } + } + # NOTE: The `eval' is necessary to flatten the $args list + # See also: http://wiki.tcl.tk/11787 - {expand} + eval assert_complete \$pick \"\$cmd \$partial\" \$test $args; #" + } +} +# If cword contains colon (:), left-trim completions with cword +# @param string $cmd Command to complete +# @param list $items Reference to list of completions to trim +# @param string $dword Reference to variable to contain word to remove from +# expected cmd. # See also: bash_completion._ltrim_colon_completions -proc _ltrim_colon_completions {cword items} { - upvar 1 $cword cword_out +proc _ltrim_colon_completions {cmd items dword} { upvar 1 $items items_out + upvar 1 $dword dword_out + + set cur ""; # Default to empty word to complete on + set words [split_words_bash $cmd] + if {[llength $words] > 1} { + # Assume last word of `$cmd' is word to complete on. + set index [expr [llength $words] - 1] + set cur [lindex $words $index] + } # If word-to-complete contains a colon, # and bash-version < 4, # or bash-version >= 4 and COMP_WORDBREAKS contains a colon if { - [string first : $cword_out] > -1 && ( + [string first : $cur] > -1 && ( [lindex $::BASH_VERSINFO 0] < 4 || ([lindex $::BASH_VERSINFO 0] >= 4 && [string first ":" $::COMP_WORDBREAKS] > -1) ) } { + set dword_out $cur for {set i 0} {$i < [llength $items_out]} {incr i} { set item [lindex $items_out $i] - if {[string first $cword_out $item] == 0} { + if {[string first $cur $item] == 0} { # Strip colon-prefix - lset items_out $i [string range $item [string length $cword_out] end] - }; # if - }; # for - #set cword_out "" - }; # if -}; # _ltrim_colon_completions() + lset items_out $i [string range $item [string length $cur] end] + } + } + } +} # Make sure the bash environment hasn't changed between now and the last call @@ -370,7 +489,7 @@ proc assert_env_unmodified {{sed ""} {file ""} {diff ""}} { append diff "\r\n" } else { set diff "" - }; # if + } # Execute diff @@ -392,11 +511,11 @@ proc assert_env_unmodified {{sed ""} {file ""} {diff ""}} { # Remove possible `\r\n[wd]@' from end of diff if {[string last "\r\n[wd]@" $diff] == [string length $diff] - [string length "\r\n[wd]@"]} { set diff [string range $diff 0 [expr [string last "\r\n[wd]@" $diff] - 1]] - }; # if + } send_user $diff; } - }; # expect -}; # assert_env_unmodified() + } +} # Make sure the specified command executed from within Tcl/Expect. @@ -426,10 +545,10 @@ proc assert_exec {cmd {stdout ''} {test ''} {failcmd "unresolved"}} { unsupported "$test" } else { $failcmd "$test" - }; # if - }; # if + } + } return $result -}; # assert_exec() +} # Check that no completion is attempted on a certain command. @@ -439,7 +558,7 @@ proc assert_exec {cmd {stdout ''} {test ''} {failcmd "unresolved"}} { proc assert_no_complete {{cmd} {test ""}} { if {[string length $test] == 0} { set test "$cmd shouldn't complete" - }; # if + } send "$cmd\t" expect -ex "$cmd" @@ -451,8 +570,8 @@ proc assert_no_complete {{cmd} {test ""}} { -re "^$endguard$" { pass "$test" } default { fail "$test" } timeout { fail "$test" } - }; # expect -}; # assert_no_complete() + } +} # Check that no output is generated on a certain command. @@ -483,7 +602,7 @@ proc assert_no_output {{cmd} {test ""} {prompt /@}} { proc assert_source_completions {command {file ""}} { if {[is_bash_completion_installed_for $command]} { if {[string length $file] == 0} { - set file "lib/completions/$command.exp" + set file "$::srcdir/lib/completions/$command.exp" } source $file } else { @@ -510,23 +629,23 @@ proc get_known_hosts {{cword ''}} { assert_bash_exec "_known_hosts_real '$cword'; echo_array COMPREPLY" \ {} /@ result return $result -}; # get_known_hosts() +} # Get hostnames # @return list Hostnames # @see get_known_hosts() proc get_hosts {} { - set hosts [exec bash -c "compgen -A hostname"] + set hosts [exec bash -c "compgen -A hostname | sort -u"] # NOTE: Circumventing var `avahi_hosts' and appending directly to `hosts' # causes an empty element to be inserted in `hosts'. # -- FVu, Fri Jul 17 23:11:46 CEST 2009 set avahi_hosts [get_hosts_avahi] if {[llength $avahi_hosts] > 0} { lappend hosts $avahi_hosts - }; # if + } return $hosts -}; # get_hosts() +} # Get hostnames according to avahi @@ -540,9 +659,9 @@ proc get_hosts_avahi {} { # No, retrieving hosts yields error; # Reset hosts set hosts {} - }; # if + } return $hosts -}; # get_hosts_avahi() +} # Get signals @@ -558,21 +677,22 @@ proc get_signals {} { set signal [string range $signal 3 end] # Add signal (with dash (-) prefix) to list lappend signals -$signal - }; # if - }; # foreach + } + } return $signals -}; # get_signals() +} # Initialize tcl globals with bash variables proc init_tcl_bash_globals {} { - global BASH_VERSINFO BASH_VERSION COMP_WORDBREAKS + global BASH_VERSINFO BASH_VERSION COMP_WORDBREAKS LC_CTYPE assert_bash_exec {printf "%s" "$COMP_WORDBREAKS"} {} /@ COMP_WORDBREAKS assert_bash_exec {printf "%s " "${BASH_VERSINFO[@]}"} "" /@ BASH_VERSINFO set BASH_VERSINFO [eval list $BASH_VERSINFO] assert_bash_exec {printf "%s" "$BASH_VERSION"} "" /@ BASH_VERSION assert_bash_exec {printf "%s" "$TESTDIR"} "" /@ TESTDIR -}; # init_tcl_bash_globals() + assert_bash_exec {eval $(locale); printf "%s" "$LC_CTYPE"} "" /@ LC_CTYPE +} # Check whether completion is installed for the specified command by executing @@ -590,22 +710,44 @@ proc is_bash_completion_installed_for {command} { } expect "/@" return $result -}; # is_bash_completion_installed_for() +} # Detect if test suite is running under Cygwin/Windows proc is_cygwin {} { expr {[string first [string tolower [exec uname -s]] cygwin] >= 0} -}; # is_cygwin() +} -# Expect items. +# Expect items, a limited number (20) at a time. # Break items into chunks because `expect' seems to have a limited buffer size -# @param list $items -# @param integer $size Chunk size +# @param list $items Expected list items +# @param list $args Options: +# -bash-sort Compare list bash-sorted. Default is +# unsorted +# -prompt PROMPT Bash prompt. Default is `/@' +# -chunk-size CHUNK-SIZE Compare list CHUNK-SIZE items at +# a time. Default is 20. +# -end-newline Expect newline after last item. +# Default is not. +# -end-prompt Expect prompt after last item. +# Default is not. +# -end-space Expect single space after last item. +# Default is not. Valid only if +# `end-newline' not set. # @result boolean True if successful, False if not -proc match_items {items test {prompt /@} {size 20}} { - set items [bash_sort $items] +proc match_items {items {args {}}} { + array set arg [::cmdline::getoptions args { + {bash-sort "compare list sorted"} + {prompt.arg "/@" "bash prompt"} + {chunk-size.arg 20 "compare N list items at a time"} + {end-newline "expect newline after last item"} + {end-prompt "expect prompt after last item"} + {end-space "expect space ater last item"} + }] + set prompt $arg(prompt) + set size $arg(chunk-size) + if {$arg(bash-sort)} {set items [bash_sort $items]} set result false for {set i 0} {$i < [llength $items]} {set i [expr {$i + $size}]} { # For chunks > 1, allow leading whitespace @@ -614,28 +756,43 @@ proc match_items {items test {prompt /@} {size 20}} { set item "[lindex $items [expr {$i + $j}]]" _escape_regexp_chars item append expected $item - if {[llength $items] > 1} {append expected {\s+}}; - }; # for + if {[llength $items] > 1} {append expected {\s+}} + } if {[llength $items] == 1} { + if {$arg(end-prompt)} {set end $prompt} {set end ""} + # Both trailing space and newline are specified? + if {$arg(end-newline) && $arg(end-space)} { + # Indicate both trailing space or newline are ok + set expected2 "|^$expected $end$"; # Include space + append expected "\r\n$end"; # Include newline + } else { + if {$arg(end-newline)} {append expected "\r\n$end"} + if {$arg(end-space)} {append expected " $end"} + set expected2 "" + } expect { - -re "^$expected\r\n$" { set result true } - # NOTE: The optional space ( ?) depends on whether -o nospace is active - -re "^$expected ?$" { set result true } + -re "^$expected$$expected2" { set result true } -re "^$prompt$" {set result false; break } - "\r\n" { set result false; break } default { set result false; break } timeout { set result false; break } - }; # expect + } } else { + set end "" + if {$arg(end-prompt) && $i + $j == [llength $items]} { + set end "$prompt" + _escape_regexp_chars end + # \$ matches real end of expect_out buffer + set end "$end\$" + } expect { - -re "^$expected" { set result true } + -re "^$expected$end" { set result true } default { set result false; break } timeout { set result false; break } - }; # expect - }; # if - }; # for + } + } + } return $result -}; # match_items() +} @@ -651,10 +808,10 @@ proc realcommand {cmd} { set result [exec readlink -f $path] } else { set result $path - }; # if - }; # if + } + } return $result -}; # realcommand() +} # Generate filename to save environment to. @@ -674,10 +831,10 @@ proc gen_env_filename {{file ""} {seq 1}} { # Remove possible '.exp' suffix from filename if {[string last ".exp" $file] == [string length $file] - [string length ".exp"]} { set file [string range $file 0 [expr [string last ".exp" $file] - 1]] - }; # if - }; # if + } + } return "\$TESTDIR/tmp/$file.env$seq~" -}; # gen_env_filename() +} # Save the environment for later comparison @@ -685,7 +842,7 @@ proc gen_env_filename {{file ""} {seq 1}} { # `gen_env_filename()'. proc save_env {{file ""}} { _save_env [gen_env_filename $file 1] -}; # save_env() +} # Save the environment for later comparison @@ -693,16 +850,16 @@ proc save_env {{file ""}} { # @see assert_env_unmodified() proc _save_env {{file ""}} { assert_bash_exec "{ set; declare -F; shopt -p; } > \"$file\"" -}; # _save_env() +} # Source bash_completion package proc source_bash_completion {} { - assert_bash_exec {BASH_COMPLETION_DIR=$(cd "$TESTDIR/.."; pwd)/contrib} + assert_bash_exec {BASH_COMPLETION_DIR=$(cd "$SRCDIR/.."; pwd)/completions} assert_bash_exec {BASH_COMPLETION_COMPAT_DIR=$BASH_COMPLETION_DIR} - assert_bash_exec {BASH_COMPLETION=$(cd "$TESTDIR/.."; pwd)/bash_completion} + assert_bash_exec {BASH_COMPLETION=$(cd "$SRCDIR/.."; pwd)/bash_completion} assert_bash_exec {source "$BASH_COMPLETION"} -}; # source_bash_completion() +} # Split line into words, disregarding backslash escapes (e.g. \b (backspace), @@ -727,7 +884,7 @@ proc split_words_bash {line} { set part [string range $part 0 [expr [string length $part] - [string length "\\"] - 1]] # Indicate glue on next run set glue_next true - }; # if + } # Must `part' be appended to latest word (= glue)? if {[llength $words] > 0 && [string is true $glue]} { # Yes, join `part' to latest word; @@ -738,11 +895,11 @@ proc split_words_bash {line} { # No, don't append word to latest word; # Append `part' as separate word lappend words $part - }; # if + } set glue $glue_next - }; # foreach + } return $words -}; # split_words_bash() +} # Given a list of items this proc finds a (part, full) pair so that when @@ -814,19 +971,22 @@ proc find_unique_completion_pair {{list} {partName} {fullName}} { # Start bash running as test environment. proc start_bash {} { - global TESTDIR TOOL_EXECUTABLE spawn_id + global TESTDIR TOOL_EXECUTABLE spawn_id env srcdirabs set TESTDIR [pwd] + set srcdirabs [file normalize $::srcdir]; # Absolute srcdir # If `--tool_exec' option not specified, use "bash" if {! [info exists TOOL_EXECUTABLE]} {set TOOL_EXECUTABLE bash} - exp_spawn $TOOL_EXECUTABLE --rcfile config/bashrc - assert_bash_exec {} "$TOOL_EXECUTABLE --rcfile config/bashrc" + set env(SRCDIR) $::srcdir + set env(SRCDIRABS) $::srcdirabs + exp_spawn $TOOL_EXECUTABLE --rcfile $::srcdir/config/bashrc + assert_bash_exec {} "$TOOL_EXECUTABLE --rcfile $::srcdir/config/bashrc" # Bash < 3.2.41 has a bug where 'history' disappears from SHELLOPTS # whenever a shopt setting is sourced or eval'ed. Disabling 'history' # makes it not show in tests "Environment should not be modified" # for bash < 3.2.41. # -- FVu, Tue Sep 15 22:52:00 CEST 2009 assert_bash_exec {is_bash_version_minimal 3 2 41 || set +o history} -}; # start_bash() +} # Redirect xtrace output to a file. @@ -896,7 +1056,7 @@ proc sync_after_tab {} { # installed, so that "^$cdm.*$" doesn't match too early - before # comp_install has finished sleep .4 -}; # sync_after_tab() +} # Return current working directory with `TESTDIR' stripped @@ -905,4 +1065,4 @@ proc wd {} { global TESTDIR # Remove `$TESTDIR' prefix from current working directory set wd [string replace [pwd] 0 [expr [string length $TESTDIR] - 1]]/ -}; # wd() +} diff --git a/test/lib/unit.exp b/test/lib/unit.exp index de870332..e113e1b5 100644 --- a/test/lib/unit.exp +++ b/test/lib/unit.exp @@ -1,4 +1,4 @@ -source lib/library.exp +source $::srcdir/lib/library.exp proc unit_exit {} { @@ -7,6 +7,14 @@ proc unit_exit {} { } +proc unit_init {test_file_name} { + # Call unit_start() only once + if {! [info exists ::BASH_VERSINFO]} { + unit_start + } +} + + proc unit_start {} { start_interactive_test } |