diff options
Diffstat (limited to 'test/lib/completions')
354 files changed, 8195 insertions, 0 deletions
diff --git a/test/lib/completions/a2ps.exp b/test/lib/completions/a2ps.exp new file mode 100644 index 00000000..796e14cc --- /dev/null +++ b/test/lib/completions/a2ps.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "a2ps " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/abook.exp b/test/lib/completions/abook.exp new file mode 100644 index 00000000..3f4e301f --- /dev/null +++ b/test/lib/completions/abook.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "abook " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/acroread.exp b/test/lib/completions/acroread.exp new file mode 100644 index 00000000..4f11f905 --- /dev/null +++ b/test/lib/completions/acroread.exp @@ -0,0 +1,22 @@ +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() + + +setup + + +assert_complete {"bar bar.d/" foo.d/ t.pdf} "acroread fixtures/shared/default/" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/add_members.exp b/test/lib/completions/add_members.exp new file mode 100644 index 00000000..02cd762d --- /dev/null +++ b/test/lib/completions/add_members.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "add_members -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/alias.exp b/test/lib/completions/alias.exp new file mode 100644 index 00000000..e6b88d00 --- /dev/null +++ b/test/lib/completions/alias.exp @@ -0,0 +1,43 @@ +proc setup {} { + assert_bash_exec "unalias -a"; # Remove all aliases + 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 + + +set test "Tab should complete alias" + # Try completion +set cmd "alias " +assert_complete {bar foo} $cmd $test + + +sync_after_int + + +set test "Tab should complete alias at cursor position" + # Try completion +set cmd "alias foo" +append cmd \002\002\002; # \002 = ^B = Move cursor left in bash emacs mode +send "$cmd\t" +expect { + -re "^alias foo\b\b\b\r\nbar +foo *\r\n/@alias foo\b\b\b$" { pass "$test" } + -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 + + +teardown diff --git a/test/lib/completions/animate.exp b/test/lib/completions/animate.exp new file mode 100644 index 00000000..26065d25 --- /dev/null +++ b/test/lib/completions/animate.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "animate " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ant.exp b/test/lib/completions/ant.exp new file mode 100644 index 00000000..81294439 --- /dev/null +++ b/test/lib/completions/ant.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "ant -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/apache2ctl.exp b/test/lib/completions/apache2ctl.exp new file mode 100644 index 00000000..e63abb16 --- /dev/null +++ b/test/lib/completions/apache2ctl.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "apache2ctl " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/apt-build.exp b/test/lib/completions/apt-build.exp new file mode 100644 index 00000000..fd09d0eb --- /dev/null +++ b/test/lib/completions/apt-build.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "apt-build " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/apt-cache.exp b/test/lib/completions/apt-cache.exp new file mode 100644 index 00000000..5336beab --- /dev/null +++ b/test/lib/completions/apt-cache.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "apt-cache " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/apt-get.exp b/test/lib/completions/apt-get.exp new file mode 100644 index 00000000..6bd0f3a2 --- /dev/null +++ b/test/lib/completions/apt-get.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +set commands {autoclean autoremove build-dep check clean dist-upgrade + dselect-upgrade install purge remove source update upgrade} +assert_complete $commands "apt-get " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/aptitude.exp b/test/lib/completions/aptitude.exp new file mode 100644 index 00000000..dde6d26e --- /dev/null +++ b/test/lib/completions/aptitude.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "aptitude " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/arch.exp b/test/lib/completions/arch.exp new file mode 100644 index 00000000..9f7114c4 --- /dev/null +++ b/test/lib/completions/arch.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +set options {--wipe -s --start= -e --end= -q --quiet -h --help} +assert_complete $options "arch -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/arpspoof.exp b/test/lib/completions/arpspoof.exp new file mode 100644 index 00000000..7db79f50 --- /dev/null +++ b/test/lib/completions/arpspoof.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "arpspoof -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/aspell.exp b/test/lib/completions/aspell.exp new file mode 100644 index 00000000..4edeb03b --- /dev/null +++ b/test/lib/completions/aspell.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "aspell " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/autoconf.exp b/test/lib/completions/autoconf.exp new file mode 100644 index 00000000..4a44b651 --- /dev/null +++ b/test/lib/completions/autoconf.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "autoconf " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/automake.exp b/test/lib/completions/automake.exp new file mode 100644 index 00000000..cf27364a --- /dev/null +++ b/test/lib/completions/automake.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "automake " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/autorpm.exp b/test/lib/completions/autorpm.exp new file mode 100644 index 00000000..99b743ca --- /dev/null +++ b/test/lib/completions/autorpm.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "autorpm " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/awk.exp b/test/lib/completions/awk.exp new file mode 100644 index 00000000..4288adbf --- /dev/null +++ b/test/lib/completions/awk.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "awk " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/bash.exp b/test/lib/completions/bash.exp new file mode 100644 index 00000000..4caf58fc --- /dev/null +++ b/test/lib/completions/bash.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "bash --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/bc.exp b/test/lib/completions/bc.exp new file mode 100644 index 00000000..c437d037 --- /dev/null +++ b/test/lib/completions/bc.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "bc --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/bison.exp b/test/lib/completions/bison.exp new file mode 100644 index 00000000..a3dea1e0 --- /dev/null +++ b/test/lib/completions/bison.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "bison --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/bk.exp b/test/lib/completions/bk.exp new file mode 100644 index 00000000..4915136e --- /dev/null +++ b/test/lib/completions/bk.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "bk " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/brctl.exp b/test/lib/completions/brctl.exp new file mode 100644 index 00000000..d87002a2 --- /dev/null +++ b/test/lib/completions/brctl.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "brctl " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/btdownloadcurses.py.exp b/test/lib/completions/btdownloadcurses.py.exp new file mode 100644 index 00000000..9dc0ba5a --- /dev/null +++ b/test/lib/completions/btdownloadcurses.py.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "btdownloadcurses.py " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/btdownloadgui.py.exp b/test/lib/completions/btdownloadgui.py.exp new file mode 100644 index 00000000..03897a53 --- /dev/null +++ b/test/lib/completions/btdownloadgui.py.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "btdownloadgui.py " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/btdownloadheadless.py.exp b/test/lib/completions/btdownloadheadless.py.exp new file mode 100644 index 00000000..69c62950 --- /dev/null +++ b/test/lib/completions/btdownloadheadless.py.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "btdownloadheadless.py " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/bzip2.exp b/test/lib/completions/bzip2.exp new file mode 100644 index 00000000..e5389a2a --- /dev/null +++ b/test/lib/completions/bzip2.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "bzip2 " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/c++.exp b/test/lib/completions/c++.exp new file mode 100644 index 00000000..1fe4bb13 --- /dev/null +++ b/test/lib/completions/c++.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +set test "Tab should complete" +assert_complete_any "c++ " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/cancel.exp b/test/lib/completions/cancel.exp new file mode 100644 index 00000000..24ca47c4 --- /dev/null +++ b/test/lib/completions/cancel.exp @@ -0,0 +1,31 @@ +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"]} { + # 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] + # Retrieve list of all current print jobs + assert_exec {lpstat | cut -d\040 -f1} jobs + # Completion should show all print jobs + assert_complete $jobs "cancel " + # Remove/cancel the test print job + assert_exec "cancel $job_id" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/cardctl.exp b/test/lib/completions/cardctl.exp new file mode 100644 index 00000000..b5d7e88d --- /dev/null +++ b/test/lib/completions/cardctl.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "cardctl " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/cat.exp b/test/lib/completions/cat.exp new file mode 100644 index 00000000..46e8775f --- /dev/null +++ b/test/lib/completions/cat.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "cat " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/cc.exp b/test/lib/completions/cc.exp new file mode 100644 index 00000000..1d63d006 --- /dev/null +++ b/test/lib/completions/cc.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "cc " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/cd.exp b/test/lib/completions/cd.exp new file mode 100644 index 00000000..58233575 --- /dev/null +++ b/test/lib/completions/cd.exp @@ -0,0 +1,47 @@ +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 + + +sync_after_int + + +set test "Tab should complete cd at cursor position" + # Try completion +set cmd "cd 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 /@ { unresolved "$test at prompt" } + default { unresolved "$test" } +}; # expect + + +sync_after_int + + +set test "Tab should complete CDPATH" + # Set CDPATH +assert_bash_exec "CDPATH=\$PWD"; +assert_complete "fixtures/shared/default/foo.d/" "cd fixtures/shared/default/fo" $test +sync_after_int + # Reset CDPATH +assert_bash_exec "unset CDPATH" + + +teardown diff --git a/test/lib/completions/cdrecord.exp b/test/lib/completions/cdrecord.exp new file mode 100644 index 00000000..d369f79d --- /dev/null +++ b/test/lib/completions/cdrecord.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "cdrecord -d" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/change_pw.exp b/test/lib/completions/change_pw.exp new file mode 100644 index 00000000..ca9bcdbd --- /dev/null +++ b/test/lib/completions/change_pw.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "change_pw -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/check_db.exp b/test/lib/completions/check_db.exp new file mode 100644 index 00000000..ca59a715 --- /dev/null +++ b/test/lib/completions/check_db.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "check_db -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/check_perms.exp b/test/lib/completions/check_perms.exp new file mode 100644 index 00000000..a58995b0 --- /dev/null +++ b/test/lib/completions/check_perms.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "check_perms -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/chgrp.exp b/test/lib/completions/chgrp.exp new file mode 100644 index 00000000..8dfeea79 --- /dev/null +++ b/test/lib/completions/chgrp.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "chgrp " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/chkconfig.exp b/test/lib/completions/chkconfig.exp new file mode 100644 index 00000000..e7469b34 --- /dev/null +++ b/test/lib/completions/chkconfig.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "chkconfig " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/chown.exp b/test/lib/completions/chown.exp new file mode 100644 index 00000000..953b2b02 --- /dev/null +++ b/test/lib/completions/chown.exp @@ -0,0 +1,72 @@ +proc setup {} { + save_env +}; # setup() + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +set users [exec bash -c "compgen -A user"] +assert_complete $users "chown " + + +sync_after_int + + +# Find user/group suitable for testing. +set failed_find_unique_completion 0 +foreach ug {user group} { + # compgen -A is used because it's a bash builtin and available everywhere. + # The || true part prevents exec from throwing an exception if nothing is + # found (very very unlikely). + set list [split [exec bash -c "compgen -A $ug || true"] "\n"] + if {![find_unique_completion_pair $list part$ug full$ug]} { + untested "Not running complex chown tests; no suitable test $ug found." + set failed_find_unique_completion 1 + } +} + +# These tests require an unique completion. +if {!$failed_find_unique_completion} { + assert_complete $fulluser "chown $partuser" + sync_after_int + + 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" + sync_after_int + + foreach prefix { + "funky\\ 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>" + #assert_complete_into "chown $prefix$partgroup" "chown $prefix$fullgroup " $test + assert_complete $prefix$fullgroup "chown $prefix$partgroup" $test + sync_after_int + } + + # Check that we give up in degenerate cases instead of spewing various junk. + + assert_no_complete "chown $fulluser\\\\:$partgroup" + sync_after_int + + assert_no_complete "chown $fulluser\\\\\\:$partgroup" + sync_after_int + + assert_no_complete "chown $fulluser\\\\\\\\:$partgroup" + sync_after_int + + # Colons in user/groupnames are not usually allowed. + assert_no_complete "chown foo:bar:$partgroup" + sync_after_int +} + + +teardown diff --git a/test/lib/completions/chsh.exp b/test/lib/completions/chsh.exp new file mode 100644 index 00000000..99262a2c --- /dev/null +++ b/test/lib/completions/chsh.exp @@ -0,0 +1,26 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "chsh -s " + + +sync_after_int + + +assert_complete [exec bash -c "compgen -A user"] "chsh " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ci.exp b/test/lib/completions/ci.exp new file mode 100644 index 00000000..09105eec --- /dev/null +++ b/test/lib/completions/ci.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "ci " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/civclient.exp b/test/lib/completions/civclient.exp new file mode 100644 index 00000000..8159c2bc --- /dev/null +++ b/test/lib/completions/civclient.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "civclient -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/civserver.exp b/test/lib/completions/civserver.exp new file mode 100644 index 00000000..df459688 --- /dev/null +++ b/test/lib/completions/civserver.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "civserver -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/cksfv.exp b/test/lib/completions/cksfv.exp new file mode 100644 index 00000000..a40a5023 --- /dev/null +++ b/test/lib/completions/cksfv.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "cksfv -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/cleanarch.exp b/test/lib/completions/cleanarch.exp new file mode 100644 index 00000000..e3145e81 --- /dev/null +++ b/test/lib/completions/cleanarch.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "cleanarch -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/clisp.exp b/test/lib/completions/clisp.exp new file mode 100644 index 00000000..2bc599ac --- /dev/null +++ b/test/lib/completions/clisp.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "clisp " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/clone_member.exp b/test/lib/completions/clone_member.exp new file mode 100644 index 00000000..34b4db57 --- /dev/null +++ b/test/lib/completions/clone_member.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "clone_member -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/co.exp b/test/lib/completions/co.exp new file mode 100644 index 00000000..49fe3a64 --- /dev/null +++ b/test/lib/completions/co.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "co " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/composite.exp b/test/lib/completions/composite.exp new file mode 100644 index 00000000..e39ce72f --- /dev/null +++ b/test/lib/completions/composite.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "composite " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/config_list.exp b/test/lib/completions/config_list.exp new file mode 100644 index 00000000..5246c860 --- /dev/null +++ b/test/lib/completions/config_list.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "config_list -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/configure.exp b/test/lib/completions/configure.exp new file mode 100644 index 00000000..74afba1b --- /dev/null +++ b/test/lib/completions/configure.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "configure --prefix " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/convert.exp b/test/lib/completions/convert.exp new file mode 100644 index 00000000..d8a77e35 --- /dev/null +++ b/test/lib/completions/convert.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "convert " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/cowsay.exp b/test/lib/completions/cowsay.exp new file mode 100644 index 00000000..dfbefe1a --- /dev/null +++ b/test/lib/completions/cowsay.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "cowsay " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/cp.exp b/test/lib/completions/cp.exp new file mode 100644 index 00000000..9fe46537 --- /dev/null +++ b/test/lib/completions/cp.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "cp " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/cpio.exp b/test/lib/completions/cpio.exp new file mode 100644 index 00000000..b02f2719 --- /dev/null +++ b/test/lib/completions/cpio.exp @@ -0,0 +1,26 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "cpio --" + + +sync_after_int + + +assert_complete [exec bash -c "compgen -A user"] "cpio -R " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/createdb.exp b/test/lib/completions/createdb.exp new file mode 100644 index 00000000..1e5cdbe7 --- /dev/null +++ b/test/lib/completions/createdb.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "createdb " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/cryptsetup.exp b/test/lib/completions/cryptsetup.exp new file mode 100644 index 00000000..e94c3ac1 --- /dev/null +++ b/test/lib/completions/cryptsetup.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "cryptsetup " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/csplit.exp b/test/lib/completions/csplit.exp new file mode 100644 index 00000000..3a66a627 --- /dev/null +++ b/test/lib/completions/csplit.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "csplit " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/cut.exp b/test/lib/completions/cut.exp new file mode 100644 index 00000000..b9bcf6c5 --- /dev/null +++ b/test/lib/completions/cut.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "cut " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/cvs.exp b/test/lib/completions/cvs.exp new file mode 100644 index 00000000..2a26da8e --- /dev/null +++ b/test/lib/completions/cvs.exp @@ -0,0 +1,36 @@ +proc setup {} { + save_env + assert_bash_exec {OLDHOME=$HOME ; HOME=$TESTDIR/fixtures/cvs} +}; # setup() + + +proc teardown {} { + assert_bash_exec {HOME=$OLDHOME} + assert_env_unmodified { + /OLDHOME=/d + } +}; # teardown() + + +setup + + +assert_complete_any "cvs " + + +sync_after_int + + +set test "-d should complete CVS roots" +set cmd "cvs -d " +send "$cmd\t" +expect { + -re "^$cmd\r\n.*:pserver:.*\r\n/@$cmd:pserver:.*$" { pass "$test" } + default { fail "$test" } +}; # expect + + +sync_after_int + + +teardown diff --git a/test/lib/completions/cvsps.exp b/test/lib/completions/cvsps.exp new file mode 100644 index 00000000..1fd4a0a9 --- /dev/null +++ b/test/lib/completions/cvsps.exp @@ -0,0 +1,36 @@ +proc setup {} { + save_env + assert_bash_exec {OLDHOME=$HOME ; HOME=$TESTDIR/fixtures/cvs} +}; # setup() + + +proc teardown {} { + assert_bash_exec {HOME=$OLDHOME} + assert_env_unmodified { + /OLDHOME=/d + } +}; # teardown() + + +setup + + +assert_complete_any "cvsps -" + + +sync_after_int + + +set test "No arguments should complete CVS roots" +set cmd "cvsps " +send "$cmd\t" +expect { + -re "^$cmd\r\n.*:pserver:.*\r\n/@$cmd:pserver:.*$" { pass "$test" } + default { fail "$test" } +}; # expect + + +sync_after_int + + +teardown diff --git a/test/lib/completions/date.exp b/test/lib/completions/date.exp new file mode 100644 index 00000000..9d75f5f3 --- /dev/null +++ b/test/lib/completions/date.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "date " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/dcop.exp b/test/lib/completions/dcop.exp new file mode 100644 index 00000000..6ed800c5 --- /dev/null +++ b/test/lib/completions/dcop.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {dcop} words]} { + assert_complete $words "dcop " +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/dd.exp b/test/lib/completions/dd.exp new file mode 100644 index 00000000..400dd143 --- /dev/null +++ b/test/lib/completions/dd.exp @@ -0,0 +1,33 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "dd --" + + +sync_after_int + + +set test "option should be suffixed with =" +set cmd "dd if" +send "$cmd\t" +expect -ex "$cmd" +expect { + -re "^=$" { pass $test } + -re {^\\=$} { xfail $test } +}; # expect + + +sync_after_int + + +teardown diff --git a/test/lib/completions/df.exp b/test/lib/completions/df.exp new file mode 100644 index 00000000..487d70a9 --- /dev/null +++ b/test/lib/completions/df.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "df " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/dhclient.exp b/test/lib/completions/dhclient.exp new file mode 100644 index 00000000..42c14c82 --- /dev/null +++ b/test/lib/completions/dhclient.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "dhclient -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/dict.exp b/test/lib/completions/dict.exp new file mode 100644 index 00000000..32fb4988 --- /dev/null +++ b/test/lib/completions/dict.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "dict -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/diff.exp b/test/lib/completions/diff.exp new file mode 100644 index 00000000..c009f640 --- /dev/null +++ b/test/lib/completions/diff.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "diff --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/dir.exp b/test/lib/completions/dir.exp new file mode 100644 index 00000000..6e20d37d --- /dev/null +++ b/test/lib/completions/dir.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "dir " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/display.exp b/test/lib/completions/display.exp new file mode 100644 index 00000000..9a9d6901 --- /dev/null +++ b/test/lib/completions/display.exp @@ -0,0 +1,41 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "display " + + +sync_after_int + + +set test "- should complete options" +set options { + -alpha -antialias -authenticate -auto-orient -backdrop -background -border + -bordercolor -borderwidth -channel -clip -clip-path -coalesce -colormap + -colors -colorspace -comment -compress -contrast -crop -debug -decipher + -define -delay -density -depth -despeckle -display -dispose -dither -edge + -endian -enhance -extract -filter -flatten -flip -flop -font -foreground + -format -frame -gamma -geometry -help -iconGeometry -iconic -identify + -immutable -interlace -interpolate -label -limit -list -log -loop -map + -mattecolor -monitor -monochrome -name -negate -page -profile -quality + -quantize -quiet -raise -regard-warnings -remote -repage -resample -resize + -respect-parenthesis -roll -rotate -sample -sampling-factor -scenes -seed + -segment -set -shared-memory -sharpen -size -strip -texture -title + -transparent-color -treedepth -trim -update -usePixmap -verbose -version + -virtual-pixel -visual -window -window-group -write } +assert_complete $options "display -" $test + + +sync_after_int + + +teardown diff --git a/test/lib/completions/dnsspoof.exp b/test/lib/completions/dnsspoof.exp new file mode 100644 index 00000000..3223a349 --- /dev/null +++ b/test/lib/completions/dnsspoof.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "dnsspoof -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/dpkg-deb.exp b/test/lib/completions/dpkg-deb.exp new file mode 100644 index 00000000..c8656610 --- /dev/null +++ b/test/lib/completions/dpkg-deb.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "dpkg-deb --c" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/dpkg-reconfigure.exp b/test/lib/completions/dpkg-reconfigure.exp new file mode 100644 index 00000000..267594be --- /dev/null +++ b/test/lib/completions/dpkg-reconfigure.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "dpkg-reconfigure --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/dpkg-source.exp b/test/lib/completions/dpkg-source.exp new file mode 100644 index 00000000..a21eff45 --- /dev/null +++ b/test/lib/completions/dpkg-source.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "dpkg-source -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/dpkg.exp b/test/lib/completions/dpkg.exp new file mode 100644 index 00000000..2bd1fb6e --- /dev/null +++ b/test/lib/completions/dpkg.exp @@ -0,0 +1,29 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "dpkg --c" + + +sync_after_int + + + # Build list of installed packages +if {[assert_exec {dpkg --get-selections | command grep \[\[:space:\]\]install$ | cut -f1} packages]} { + assert_complete $packages "dpkg -L " +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/dropdb.exp b/test/lib/completions/dropdb.exp new file mode 100644 index 00000000..e78a2ba7 --- /dev/null +++ b/test/lib/completions/dropdb.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "dropdb " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/dselect.exp b/test/lib/completions/dselect.exp new file mode 100644 index 00000000..f6257294 --- /dev/null +++ b/test/lib/completions/dselect.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "dselect " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/dsniff.exp b/test/lib/completions/dsniff.exp new file mode 100644 index 00000000..a0cc43ac --- /dev/null +++ b/test/lib/completions/dsniff.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "dsniff -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/du.exp b/test/lib/completions/du.exp new file mode 100644 index 00000000..d1ffa8ca --- /dev/null +++ b/test/lib/completions/du.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "du " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/dumpdb.exp b/test/lib/completions/dumpdb.exp new file mode 100644 index 00000000..240214b3 --- /dev/null +++ b/test/lib/completions/dumpdb.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "dumpdb " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/enscript.exp b/test/lib/completions/enscript.exp new file mode 100644 index 00000000..7fefabdd --- /dev/null +++ b/test/lib/completions/enscript.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "enscript --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/env.exp b/test/lib/completions/env.exp new file mode 100644 index 00000000..f03f5395 --- /dev/null +++ b/test/lib/completions/env.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {env --help} "" "" "unsupported"]} { + assert_complete_any "env --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/evince.exp b/test/lib/completions/evince.exp new file mode 100644 index 00000000..22279a26 --- /dev/null +++ b/test/lib/completions/evince.exp @@ -0,0 +1,35 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified {/OLDPWD=/d} +}; # teardown() + + +setup + + +# NOTE: The directory `fixtures/evince' contains an additional subdir `foo' +# (should be visible as completion) and an additional file `.txt' +# (shouldn't be visible as completion) +set files { + foo/ + .bmp .BMP .cbr .CBR .cbz .CBZ .djv .DJV .djvu .DJVU + .dvi .DVI .dvi.bz2 .dvi.BZ2 .DVI.bz2 .DVI.BZ2 .dvi.gz .dvi.GZ .DVI.gz .DVI.GZ + .eps .EPS .eps.bz2 .eps.BZ2 .EPS.bz2 .EPS.BZ2 .eps.gz .eps.GZ .EPS.gz .EPS.GZ + .gif .GIF .ico .ICO .jpeg .JPEG .jpg .JPG .miff .MIFF .pbm .PBM .pcx .PCX + .pdf .PDF .pdf.bz2 .pdf.BZ2 .PDF.bz2 .PDF.BZ2 .pdf.gz .pdf.GZ .PDF.gz .PDF.GZ + .pgm .PGM .png .PNG .pnm .PNM .ppm .PPM + .ps .PS .ps.bz2 .ps.BZ2 .PS.bz2 .PS.BZ2 .ps.gz .ps.GZ .PS.gz .PS.GZ + .tga .TGA .tif .TIF .tiff .TIFF + .xpm .XPM .xwd .XWD +} +assert_complete_dir $files "evince " "fixtures/evince" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/expand.exp b/test/lib/completions/expand.exp new file mode 100644 index 00000000..d5cd6b17 --- /dev/null +++ b/test/lib/completions/expand.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {expand --help} "" "" "unsupported"]} { + assert_complete_any "expand --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/filesnarf.exp b/test/lib/completions/filesnarf.exp new file mode 100644 index 00000000..53cf01e4 --- /dev/null +++ b/test/lib/completions/filesnarf.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "filesnarf -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/find.exp b/test/lib/completions/find.exp new file mode 100644 index 00000000..4b1728dc --- /dev/null +++ b/test/lib/completions/find.exp @@ -0,0 +1,80 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified {/OLDPWD=/d} +}; # teardown() + + +setup + + +assert_complete_any "find " + + +sync_after_int + + +assert_complete_any "find -fstype " + + +sync_after_int + + +set options [list -daystart -depth -follow -help \ + -ignore_readdir_race -maxdepth -mindepth -mindepth -mount \ + -noignore_readdir_race -noleaf -regextype -version -warn -nowarn \ + -xdev \ + -amin -anewer -atime -cmin -cnewer -ctime -empty -executable -false \ + -fstype -gid -group -ilname -iname -inum -ipath -iregex -iwholename \ + -links -lname -mmin -mtime -name -newer -nogroup -nouser -path -perm \ + -readable -regex -samefile -size -true -type -uid -used -user \ + -wholename -writable -xtype -context \ + -delete -exec -execdir -fls -fprint -fprint0 -fprintf -ls -ok -okdir \ + -print -print0 -printf -prune -quit] +assert_complete $options {find -} + + +sync_after_int + + +set test "-wholename should complete files/dirs" +set dir fixtures/shared/default +set files [split [exec bash -c "cd $dir && ls -p"] "\n"] +assert_complete_dir $files "find -wholename " $dir + + +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 + + +teardown diff --git a/test/lib/completions/find_member.exp b/test/lib/completions/find_member.exp new file mode 100644 index 00000000..58fac7d2 --- /dev/null +++ b/test/lib/completions/find_member.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "find_member -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/finger.exp b/test/lib/completions/finger.exp new file mode 100644 index 00000000..30f2b080 --- /dev/null +++ b/test/lib/completions/finger.exp @@ -0,0 +1,57 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +set test "Tab should complete usernames" +# Build string list of usernames +set users {} +foreach u [exec bash -c "compgen -A user"] { + lappend users $u +}; # foreach +assert_complete $users "finger " $test + + +sync_after_int + + +set test "Tab should complete partial username" +assert_complete_partial [exec bash -c "compgen -A user"] "finger" + + +sync_after_int + + +set test "Tab should complete partial hostname" +# Build string list of hostnames, starting with the character of the first +# host, unless host starts with a COMP_WORDBREAKS character, e.g. a colon (:). +# Hosts starting with a COMP_WORDBREAKS character are left out because these +# are exceptional cases, requiring specific tests. +set hosts {} +set char "" +foreach h [get_known_hosts] { + set first [string range $h 0 0] + if {$char == "" && [string first $first $COMP_WORDBREAKS] == -1} {set char $first} + if {$char != ""} { + # Only append unique hostnames starting with $char + if {$first == $char && [lsearch -exact $hosts "test@$h"] == -1} { + # Prefix hosts with username 'test@' + lappend hosts "test@$h" + }; # if + }; # if +}; # foreach +assert_complete $hosts "finger test@$char" $test + + +sync_after_int + + +teardown diff --git a/test/lib/completions/fmt.exp b/test/lib/completions/fmt.exp new file mode 100644 index 00000000..28570682 --- /dev/null +++ b/test/lib/completions/fmt.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {fmt --help} "" "" "unsupported"]} { + assert_complete_any "fmt -" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/fold.exp b/test/lib/completions/fold.exp new file mode 100644 index 00000000..a5230b03 --- /dev/null +++ b/test/lib/completions/fold.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {fold --help} "" "" "unsupported"]} { + assert_complete_any "fold --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/g++.exp b/test/lib/completions/g++.exp new file mode 100644 index 00000000..4dc2591a --- /dev/null +++ b/test/lib/completions/g++.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "g++ " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/g4.exp b/test/lib/completions/g4.exp new file mode 100644 index 00000000..203de061 --- /dev/null +++ b/test/lib/completions/g4.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "g4 " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/g77.exp b/test/lib/completions/g77.exp new file mode 100644 index 00000000..8802aca9 --- /dev/null +++ b/test/lib/completions/g77.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "g77 " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/gcc.exp b/test/lib/completions/gcc.exp new file mode 100644 index 00000000..8e52a120 --- /dev/null +++ b/test/lib/completions/gcc.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "gcc " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/gcj.exp b/test/lib/completions/gcj.exp new file mode 100644 index 00000000..db52d59a --- /dev/null +++ b/test/lib/completions/gcj.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "gcj " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/gcl.exp b/test/lib/completions/gcl.exp new file mode 100644 index 00000000..7cead846 --- /dev/null +++ b/test/lib/completions/gcl.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "gcl " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/gdb.exp b/test/lib/completions/gdb.exp new file mode 100644 index 00000000..982f0878 --- /dev/null +++ b/test/lib/completions/gdb.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "gdb - " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/genaliases.exp b/test/lib/completions/genaliases.exp new file mode 100644 index 00000000..064eb386 --- /dev/null +++ b/test/lib/completions/genaliases.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "genaliases -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/getent.exp b/test/lib/completions/getent.exp new file mode 100644 index 00000000..121f3b38 --- /dev/null +++ b/test/lib/completions/getent.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "getent " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/gkrellm.exp b/test/lib/completions/gkrellm.exp new file mode 100644 index 00000000..f8b0dd4d --- /dev/null +++ b/test/lib/completions/gkrellm.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "gkrellm -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/gmplayer.exp b/test/lib/completions/gmplayer.exp new file mode 100644 index 00000000..d9032698 --- /dev/null +++ b/test/lib/completions/gmplayer.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "gmplayer " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/gnatmake.exp b/test/lib/completions/gnatmake.exp new file mode 100644 index 00000000..902aa062 --- /dev/null +++ b/test/lib/completions/gnatmake.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "gnatmake " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/gpc.exp b/test/lib/completions/gpc.exp new file mode 100644 index 00000000..6c4d0383 --- /dev/null +++ b/test/lib/completions/gpc.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "gpc " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/gperf.exp b/test/lib/completions/gperf.exp new file mode 100644 index 00000000..aa24333e --- /dev/null +++ b/test/lib/completions/gperf.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "gperf --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/gpg.exp b/test/lib/completions/gpg.exp new file mode 100644 index 00000000..29fd2244 --- /dev/null +++ b/test/lib/completions/gpg.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "gpg " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/gprof.exp b/test/lib/completions/gprof.exp new file mode 100644 index 00000000..592786af --- /dev/null +++ b/test/lib/completions/gprof.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {gprof --help} "" "" "unsupported"]} { + assert_complete_any "gprof --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/grep.exp b/test/lib/completions/grep.exp new file mode 100644 index 00000000..3814df71 --- /dev/null +++ b/test/lib/completions/grep.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "grep --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/grub.exp b/test/lib/completions/grub.exp new file mode 100644 index 00000000..9578e789 --- /dev/null +++ b/test/lib/completions/grub.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "grub --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/gzip.exp b/test/lib/completions/gzip.exp new file mode 100644 index 00000000..f212c61a --- /dev/null +++ b/test/lib/completions/gzip.exp @@ -0,0 +1,28 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +set test "Tab should complete" + # Try completion +set cmd "gzip " +send "$cmd\t" +expect { + -re "^$cmd\r\n.*$cmd$" { pass "$test" } + -re /@ { unresolved "$test at prompt" } + -re eof { unresolved "eof" } +}; # expect + + +sync_after_int + + +teardown diff --git a/test/lib/completions/hcitool.exp b/test/lib/completions/hcitool.exp new file mode 100644 index 00000000..9283adff --- /dev/null +++ b/test/lib/completions/hcitool.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "hcitool " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/head.exp b/test/lib/completions/head.exp new file mode 100644 index 00000000..0d4f6a20 --- /dev/null +++ b/test/lib/completions/head.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {head --help} "" "" "unsupported"]} { + assert_complete_any "head --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/iconv.exp b/test/lib/completions/iconv.exp new file mode 100644 index 00000000..420e923c --- /dev/null +++ b/test/lib/completions/iconv.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "iconv -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/id.exp b/test/lib/completions/id.exp new file mode 100644 index 00000000..155af52c --- /dev/null +++ b/test/lib/completions/id.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "id -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/identify.exp b/test/lib/completions/identify.exp new file mode 100644 index 00000000..8f38ae47 --- /dev/null +++ b/test/lib/completions/identify.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "identify -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ifdown.exp b/test/lib/completions/ifdown.exp new file mode 100644 index 00000000..68225bb9 --- /dev/null +++ b/test/lib/completions/ifdown.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "ifdown " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ifup.exp b/test/lib/completions/ifup.exp new file mode 100644 index 00000000..9d717178 --- /dev/null +++ b/test/lib/completions/ifup.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "ifup " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/indent.exp b/test/lib/completions/indent.exp new file mode 100644 index 00000000..e8fc32b1 --- /dev/null +++ b/test/lib/completions/indent.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "indent --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/info.exp b/test/lib/completions/info.exp new file mode 100644 index 00000000..ed769f1a --- /dev/null +++ b/test/lib/completions/info.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "info " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/inject.exp b/test/lib/completions/inject.exp new file mode 100644 index 00000000..7c093146 --- /dev/null +++ b/test/lib/completions/inject.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "inject " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/insmod.exp b/test/lib/completions/insmod.exp new file mode 100644 index 00000000..8e83f0b4 --- /dev/null +++ b/test/lib/completions/insmod.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "insmod in" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/invoke-rc.d.exp b/test/lib/completions/invoke-rc.d.exp new file mode 100644 index 00000000..4dc9f1d8 --- /dev/null +++ b/test/lib/completions/invoke-rc.d.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "invoke-rc.d " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ipsec.exp b/test/lib/completions/ipsec.exp new file mode 100644 index 00000000..15617a16 --- /dev/null +++ b/test/lib/completions/ipsec.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "ipsec " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ipv6calc.exp b/test/lib/completions/ipv6calc.exp new file mode 100644 index 00000000..74ce95f7 --- /dev/null +++ b/test/lib/completions/ipv6calc.exp @@ -0,0 +1,26 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "ipv6calc -" + + +sync_after_int + + +assert_complete_any "ipv6calc --in " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/irb.exp b/test/lib/completions/irb.exp new file mode 100644 index 00000000..81bea6d2 --- /dev/null +++ b/test/lib/completions/irb.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "irb " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/isql.exp b/test/lib/completions/isql.exp new file mode 100644 index 00000000..87e16bca --- /dev/null +++ b/test/lib/completions/isql.exp @@ -0,0 +1,23 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified {/ODBCINI=/d} +}; # teardown() + + +setup + + +assert_bash_exec {OLDODBCINI=$ODBCINI; ODBCINI=$TESTDIR/fixtures/isql/odbc.ini} +assert_complete_any "isql " +sync_after_int +assert_bash_exec {ODBCINI=$OLDODBCINI; unset -v OLDODBCINI} + + +sync_after_int + + +teardown diff --git a/test/lib/completions/iwconfig.exp b/test/lib/completions/iwconfig.exp new file mode 100644 index 00000000..f09719d7 --- /dev/null +++ b/test/lib/completions/iwconfig.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "iwconfig --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/iwlist.exp b/test/lib/completions/iwlist.exp new file mode 100644 index 00000000..80a2c367 --- /dev/null +++ b/test/lib/completions/iwlist.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "iwlist --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/iwpriv.exp b/test/lib/completions/iwpriv.exp new file mode 100644 index 00000000..f3102cc5 --- /dev/null +++ b/test/lib/completions/iwpriv.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "iwpriv --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/iwspy.exp b/test/lib/completions/iwspy.exp new file mode 100644 index 00000000..5fa0bee5 --- /dev/null +++ b/test/lib/completions/iwspy.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_env_unmodified "iwspy --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/jar.exp b/test/lib/completions/jar.exp new file mode 100644 index 00000000..0e11f684 --- /dev/null +++ b/test/lib/completions/jar.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "jar " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/jarsigner.exp b/test/lib/completions/jarsigner.exp new file mode 100644 index 00000000..075e0263 --- /dev/null +++ b/test/lib/completions/jarsigner.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "jarsigner " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/java.exp b/test/lib/completions/java.exp new file mode 100644 index 00000000..14610b2f --- /dev/null +++ b/test/lib/completions/java.exp @@ -0,0 +1,46 @@ +proc setup {} { + assert_bash_exec {CLASSPATH=$TESTDIR/fixtures/java/a:$TESTDIR/fixtures/java/bashcomp.jar} + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "java -" + + +sync_after_int + + +assert_complete "b bashcomp.jarred toplevel" "java " + + +sync_after_int + + +assert_complete "bashcomp.jarred toplevel" \ + "java -cp fixtures/java/bashcomp.jar " + + +sync_after_int + + +assert_no_complete "java -cp \"\" " + + +sync_after_int + + +assert_complete "a/ bashcomp.jar" "java -jar fixtures/java/" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/javac.exp b/test/lib/completions/javac.exp new file mode 100644 index 00000000..6013de11 --- /dev/null +++ b/test/lib/completions/javac.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "javac " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/javadoc.exp b/test/lib/completions/javadoc.exp new file mode 100644 index 00000000..40c922ca --- /dev/null +++ b/test/lib/completions/javadoc.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "javadoc " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/k3b.exp b/test/lib/completions/k3b.exp new file mode 100644 index 00000000..86942d67 --- /dev/null +++ b/test/lib/completions/k3b.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "k3b " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/kdvi.exp b/test/lib/completions/kdvi.exp new file mode 100644 index 00000000..0196049a --- /dev/null +++ b/test/lib/completions/kdvi.exp @@ -0,0 +1,27 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified {/OLDPWD=/d} +}; # teardown() + + +setup + + +# NOTE: The directory `fixtures/kdvi' contains an additional subdir `foo' +# (should be visible as completion) and an additional file `.txt' +# (shouldn't be visible as completion) +set files { + foo/ + .dvi .DVI .dvi.bz2 .DVI.bz2 .dvi.gz .DVI.gz .dvi.Z .DVI.Z +} +assert_complete_dir $files "kdvi " "fixtures/kdvi" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/kill.exp b/test/lib/completions/kill.exp new file mode 100644 index 00000000..ca02650c --- /dev/null +++ b/test/lib/completions/kill.exp @@ -0,0 +1,26 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "kill 1" + + +sync_after_int + + +assert_complete [get_signals] "kill -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/killall.exp b/test/lib/completions/killall.exp new file mode 100644 index 00000000..763c8e7d --- /dev/null +++ b/test/lib/completions/killall.exp @@ -0,0 +1,26 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "killall " + + +sync_after_int + + +assert_complete [get_signals] "killall -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/kldload.exp b/test/lib/completions/kldload.exp new file mode 100644 index 00000000..0493a10a --- /dev/null +++ b/test/lib/completions/kldload.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "kldload " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/kldunload.exp b/test/lib/completions/kldunload.exp new file mode 100644 index 00000000..192159a5 --- /dev/null +++ b/test/lib/completions/kldunload.exp @@ -0,0 +1,24 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[catch {eval exec {kldstat | grep "\.ko$"}}] == 0} { + assert_complete_any "kldunload " +} else { + assert_no_complete "kldunload " +} + + +sync_after_int + + +teardown diff --git a/test/lib/completions/kpdf.exp b/test/lib/completions/kpdf.exp new file mode 100644 index 00000000..010abcfb --- /dev/null +++ b/test/lib/completions/kpdf.exp @@ -0,0 +1,26 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified {/OLDPWD=/d} +}; # teardown() + + +setup + + +# NOTE: The directory `fixtures/kpdf' contains an additional subdir `foo' +# (should be visible as completion) and an additional file `.txt' +# (shouldn't be visible as completion) +set files { + foo/ .eps .ps .EPS .PS .pdf .PDF +} +assert_complete_dir $files "kpdf " "fixtures/kpdf" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/kplayer.exp b/test/lib/completions/kplayer.exp new file mode 100644 index 00000000..34c9b3bf --- /dev/null +++ b/test/lib/completions/kplayer.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "kplayer " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/larch.exp b/test/lib/completions/larch.exp new file mode 100644 index 00000000..076016f2 --- /dev/null +++ b/test/lib/completions/larch.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "larch library-" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ld.exp b/test/lib/completions/ld.exp new file mode 100644 index 00000000..60377991 --- /dev/null +++ b/test/lib/completions/ld.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "ld " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ldd.exp b/test/lib/completions/ldd.exp new file mode 100644 index 00000000..e45d1df7 --- /dev/null +++ b/test/lib/completions/ldd.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "ldd " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/less.exp b/test/lib/completions/less.exp new file mode 100644 index 00000000..269c9b5c --- /dev/null +++ b/test/lib/completions/less.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "less --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lftp.exp b/test/lib/completions/lftp.exp new file mode 100644 index 00000000..a49a1935 --- /dev/null +++ b/test/lib/completions/lftp.exp @@ -0,0 +1,24 @@ +proc setup {} { + assert_bash_exec {HOME=$TESTDIR/fixtures/lftp} + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +set expected [get_hosts] +# `lftptest' is defined in ./fixtures/lftp/.lftp/bookmarks +lappend expected lftptest +assert_complete $expected "lftp " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lftpget.exp b/test/lib/completions/lftpget.exp new file mode 100644 index 00000000..7d80216e --- /dev/null +++ b/test/lib/completions/lftpget.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lftpget -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lilo.exp b/test/lib/completions/lilo.exp new file mode 100644 index 00000000..505a1470 --- /dev/null +++ b/test/lib/completions/lilo.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lilo -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/links.exp b/test/lib/completions/links.exp new file mode 100644 index 00000000..9f4896aa --- /dev/null +++ b/test/lib/completions/links.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "links " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lisp.exp b/test/lib/completions/lisp.exp new file mode 100644 index 00000000..21663628 --- /dev/null +++ b/test/lib/completions/lisp.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lisp " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/list_admins.exp b/test/lib/completions/list_admins.exp new file mode 100644 index 00000000..e1c9c4dd --- /dev/null +++ b/test/lib/completions/list_admins.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "list_admins -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/list_lists.exp b/test/lib/completions/list_lists.exp new file mode 100644 index 00000000..789ab1a8 --- /dev/null +++ b/test/lib/completions/list_lists.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "list_lists -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/list_members.exp b/test/lib/completions/list_members.exp new file mode 100644 index 00000000..c93b53d7 --- /dev/null +++ b/test/lib/completions/list_members.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "list_members -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/list_owners.exp b/test/lib/completions/list_owners.exp new file mode 100644 index 00000000..c96e0229 --- /dev/null +++ b/test/lib/completions/list_owners.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "list_owners -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ln.exp b/test/lib/completions/ln.exp new file mode 100644 index 00000000..34786071 --- /dev/null +++ b/test/lib/completions/ln.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "ln " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/look.exp b/test/lib/completions/look.exp new file mode 100644 index 00000000..53a3c464 --- /dev/null +++ b/test/lib/completions/look.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {look foo | grep ^foo} words]} { + assert_complete $words "look foo" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ls.exp b/test/lib/completions/ls.exp new file mode 100644 index 00000000..db2d41d3 --- /dev/null +++ b/test/lib/completions/ls.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {ls --help} "" "" "unsupported"]} { + assert_complete_any "ls --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lvchange.exp b/test/lib/completions/lvchange.exp new file mode 100644 index 00000000..ec3886b8 --- /dev/null +++ b/test/lib/completions/lvchange.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lvchange --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lvcreate.exp b/test/lib/completions/lvcreate.exp new file mode 100644 index 00000000..46dceb79 --- /dev/null +++ b/test/lib/completions/lvcreate.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lvcreate --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lvdisplay.exp b/test/lib/completions/lvdisplay.exp new file mode 100644 index 00000000..5a01a0e5 --- /dev/null +++ b/test/lib/completions/lvdisplay.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lvdisplay --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lvextend.exp b/test/lib/completions/lvextend.exp new file mode 100644 index 00000000..24a63853 --- /dev/null +++ b/test/lib/completions/lvextend.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lvextend --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lvm.exp b/test/lib/completions/lvm.exp new file mode 100644 index 00000000..1c67825e --- /dev/null +++ b/test/lib/completions/lvm.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lvm pv" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lvmdiskscan.exp b/test/lib/completions/lvmdiskscan.exp new file mode 100644 index 00000000..27e566d4 --- /dev/null +++ b/test/lib/completions/lvmdiskscan.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lvmdiskscan --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lvreduce.exp b/test/lib/completions/lvreduce.exp new file mode 100644 index 00000000..edd5150d --- /dev/null +++ b/test/lib/completions/lvreduce.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lvreduce --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lvremove.exp b/test/lib/completions/lvremove.exp new file mode 100644 index 00000000..1cd63150 --- /dev/null +++ b/test/lib/completions/lvremove.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lvremove --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lvrename.exp b/test/lib/completions/lvrename.exp new file mode 100644 index 00000000..51624222 --- /dev/null +++ b/test/lib/completions/lvrename.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lvrename --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lvresize.exp b/test/lib/completions/lvresize.exp new file mode 100644 index 00000000..830b9ab1 --- /dev/null +++ b/test/lib/completions/lvresize.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lvresize --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lvs.exp b/test/lib/completions/lvs.exp new file mode 100644 index 00000000..8b239f5d --- /dev/null +++ b/test/lib/completions/lvs.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lvs --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lvscan.exp b/test/lib/completions/lvscan.exp new file mode 100644 index 00000000..841fd0ed --- /dev/null +++ b/test/lib/completions/lvscan.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lvscan --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lzma.exp b/test/lib/completions/lzma.exp new file mode 100644 index 00000000..79d78854 --- /dev/null +++ b/test/lib/completions/lzma.exp @@ -0,0 +1,26 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lzma " + + +sync_after_int + + +assert_complete "a/ bashcomp.lzma bashcomp.tlz" "lzma -d fixtures/xz/" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/lzop.exp b/test/lib/completions/lzop.exp new file mode 100644 index 00000000..c33e814e --- /dev/null +++ b/test/lib/completions/lzop.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "lzop " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/m4.exp b/test/lib/completions/m4.exp new file mode 100644 index 00000000..2cc884b3 --- /dev/null +++ b/test/lib/completions/m4.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {m4 --help} "" "" "unsupported"]} { + assert_complete_any "m4 --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/macof.exp b/test/lib/completions/macof.exp new file mode 100644 index 00000000..e21b1e77 --- /dev/null +++ b/test/lib/completions/macof.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "macof -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mailmanctl.exp b/test/lib/completions/mailmanctl.exp new file mode 100644 index 00000000..a69b7650 --- /dev/null +++ b/test/lib/completions/mailmanctl.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mailmanctl " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mailsnarf.exp b/test/lib/completions/mailsnarf.exp new file mode 100644 index 00000000..df9981b7 --- /dev/null +++ b/test/lib/completions/mailsnarf.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mailsnarf -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/make.exp b/test/lib/completions/make.exp new file mode 100644 index 00000000..90b9e68b --- /dev/null +++ b/test/lib/completions/make.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "make " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/man.exp b/test/lib/completions/man.exp new file mode 100644 index 00000000..62c14c86 --- /dev/null +++ b/test/lib/completions/man.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "man man" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mc.exp b/test/lib/completions/mc.exp new file mode 100644 index 00000000..866161ba --- /dev/null +++ b/test/lib/completions/mc.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mc -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mcrypt.exp b/test/lib/completions/mcrypt.exp new file mode 100644 index 00000000..bfc5d2d2 --- /dev/null +++ b/test/lib/completions/mcrypt.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mcrypt " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/md5sum.exp b/test/lib/completions/md5sum.exp new file mode 100644 index 00000000..25290b56 --- /dev/null +++ b/test/lib/completions/md5sum.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "md5sum " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mdecrypt.exp b/test/lib/completions/mdecrypt.exp new file mode 100644 index 00000000..4e49ae12 --- /dev/null +++ b/test/lib/completions/mdecrypt.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mdecrypt " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mencoder.exp b/test/lib/completions/mencoder.exp new file mode 100644 index 00000000..169dcb71 --- /dev/null +++ b/test/lib/completions/mencoder.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mencoder " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/minicom.exp b/test/lib/completions/minicom.exp new file mode 100644 index 00000000..935502f1 --- /dev/null +++ b/test/lib/completions/minicom.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "minicom -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mkdir.exp b/test/lib/completions/mkdir.exp new file mode 100644 index 00000000..43dfec7e --- /dev/null +++ b/test/lib/completions/mkdir.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mkdir " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mkfifo.exp b/test/lib/completions/mkfifo.exp new file mode 100644 index 00000000..c6343f8d --- /dev/null +++ b/test/lib/completions/mkfifo.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mkfifo " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mkinitrd.exp b/test/lib/completions/mkinitrd.exp new file mode 100644 index 00000000..cfb316e5 --- /dev/null +++ b/test/lib/completions/mkinitrd.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mkinitrd " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mkisofs.exp b/test/lib/completions/mkisofs.exp new file mode 100644 index 00000000..ad24ea06 --- /dev/null +++ b/test/lib/completions/mkisofs.exp @@ -0,0 +1,48 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mkisofs " + + +sync_after_int + + +set test "-uid should complete uids" + # Try completion +set cmd "mkisofs -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" + # Try completion +set cmd "mkisofs -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 + + +teardown diff --git a/test/lib/completions/mknod.exp b/test/lib/completions/mknod.exp new file mode 100644 index 00000000..2c58cade --- /dev/null +++ b/test/lib/completions/mknod.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mknod " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mmsitepass.exp b/test/lib/completions/mmsitepass.exp new file mode 100644 index 00000000..d69fa202 --- /dev/null +++ b/test/lib/completions/mmsitepass.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mmsitepass " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/module.exp b/test/lib/completions/module.exp new file mode 100644 index 00000000..a34667d4 --- /dev/null +++ b/test/lib/completions/module.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "module " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mogrify.exp b/test/lib/completions/mogrify.exp new file mode 100644 index 00000000..ef7e18ee --- /dev/null +++ b/test/lib/completions/mogrify.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mogrify " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/montage.exp b/test/lib/completions/montage.exp new file mode 100644 index 00000000..736609a5 --- /dev/null +++ b/test/lib/completions/montage.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "montage " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mount.exp b/test/lib/completions/mount.exp new file mode 100644 index 00000000..38d93e3b --- /dev/null +++ b/test/lib/completions/mount.exp @@ -0,0 +1,121 @@ +# mount completion from fstab can't be tested directly because it +# (correctly) uses absolute paths. So we create a custom completion which +# reads from a file in our text fixture instead. +proc setup_dummy_mnt {} { + assert_bash_exec {unset COMPREPLY cur} + assert_bash_exec {unset -f _mnt} + + global TESTDIR + assert_bash_exec { \ + _mnt() { \ + local cur=$(_get_cword); \ + _linux_fstab $(_get_pword) < "$TESTDIR/fixtures/mount/test-fstab"; \ + }; \ + complete -F _mnt mnt \ + } +} + + +proc teardown_dummy_mnt {} { + assert_bash_exec {unset COMPREPLY cur} + assert_bash_exec {unset -f _mnt} + assert_bash_exec {complete -r mnt} +} + + +proc setup {} { + save_env + setup_dummy_mnt +} + + +proc teardown {} { + teardown_dummy_mnt + assert_env_unmodified +} + + +setup + + +assert_complete_any "mount " + + +sync_after_int + + +assert_complete_any "mount -t " + + +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";} +# This needs an explicit cword param or will output "unresolved". +assert_complete $expected $cmd $test "/@" 20 "/" +sync_after_int +assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} + + +sync_after_int + + +set test "Testing internal __linux_fstab_unescape function for mount" +# One round of slashes is for bash. +assert_bash_exec {var=one\'two\\040three\\} +assert_bash_exec {__linux_fstab_unescape var} +set cmd {echo $var} +send "$cmd\r" +expect { + -ex "$cmd\r\none'two three\\" { pass $test } +# default { fail $test } +} +sync_after_int +assert_bash_exec {unset var} + + +sync_after_int + + +# Begin testing through mnt (see setup_dummy_mnt). +assert_complete {/mnt/nice-test-path} {mnt /mnt/nice-test-p} +sync_after_int + +assert_complete {/mnt/nice\ test-path} {mnt /mnt/nice\ test-p} +sync_after_int + +assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$test-p} +sync_after_int + +assert_complete {/mnt/nice\ test\\path} {mnt /mnt/nice\ test\\p} +sync_after_int + +assert_complete {{/mnt/nice\ test\\path} {/mnt/nice\ test-path}} \ + {mnt /mnt/nice\ } "" /@ 20 {/mnt/nice\ } +sync_after_int + +assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$} +sync_after_int + +assert_complete {/mnt/nice\'test-path} {mnt /mnt/nice\'} +sync_after_int + +assert_complete {/mnt/other\'test\ path} {mnt /mnt/other} +sync_after_int + +assert_complete {Ubuntu\ Karmic} {mnt -L Ubu} +sync_after_int + +assert_complete {Debian-it\'s\ awesome} {mnt -L Deb} +sync_after_int + +# This does not work. Proper support for this requires smarter parsing of +# $COMP_LINE and it's not worth doing just for mount. +#assert_complete {$'/mnt/nice\ntest-path'} {mnt $'/mnt/nice\n} +#sync_after_int + + +teardown diff --git a/test/lib/completions/mplayer.exp b/test/lib/completions/mplayer.exp new file mode 100644 index 00000000..69e5d971 --- /dev/null +++ b/test/lib/completions/mplayer.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mplayer " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/msgsnarf.exp b/test/lib/completions/msgsnarf.exp new file mode 100644 index 00000000..74f458ff --- /dev/null +++ b/test/lib/completions/msgsnarf.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "msgsnarf -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mtx.exp b/test/lib/completions/mtx.exp new file mode 100644 index 00000000..a518d79f --- /dev/null +++ b/test/lib/completions/mtx.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mtx " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mutt.exp b/test/lib/completions/mutt.exp new file mode 100644 index 00000000..6c727daf --- /dev/null +++ b/test/lib/completions/mutt.exp @@ -0,0 +1,33 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified {/OLDPWD=/d} +}; # teardown() + + +setup + + +assert_complete_any "mutt -" + + +sync_after_int + + +set test "mutt should complete mailboxes" +set expected {foo/ bar/ muttrc} +assert_complete_dir $expected "mutt -F muttrc -f =" fixtures/mutt + + +set test "mutt should complete aliases" +set expected {a1 a2} +assert_complete_dir $expected "mutt -F muttrc -A " fixtures/mutt + + +sync_after_int + + +teardown diff --git a/test/lib/completions/muttng.exp b/test/lib/completions/muttng.exp new file mode 100644 index 00000000..25a474ad --- /dev/null +++ b/test/lib/completions/muttng.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "muttng -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mv.exp b/test/lib/completions/mv.exp new file mode 100644 index 00000000..f2576df7 --- /dev/null +++ b/test/lib/completions/mv.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mv " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/mysqladmin.exp b/test/lib/completions/mysqladmin.exp new file mode 100644 index 00000000..76381587 --- /dev/null +++ b/test/lib/completions/mysqladmin.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "mysqladmin -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ncftp.exp b/test/lib/completions/ncftp.exp new file mode 100644 index 00000000..ad71f226 --- /dev/null +++ b/test/lib/completions/ncftp.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "ncftp " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/netstat.exp b/test/lib/completions/netstat.exp new file mode 100644 index 00000000..0e6414d6 --- /dev/null +++ b/test/lib/completions/netstat.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "netstat " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/newlist.exp b/test/lib/completions/newlist.exp new file mode 100644 index 00000000..bebf600d --- /dev/null +++ b/test/lib/completions/newlist.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "newlist " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/nl.exp b/test/lib/completions/nl.exp new file mode 100644 index 00000000..02076dff --- /dev/null +++ b/test/lib/completions/nl.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "nl " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/nm.exp b/test/lib/completions/nm.exp new file mode 100644 index 00000000..551f49e9 --- /dev/null +++ b/test/lib/completions/nm.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "nm " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ntpdate.exp b/test/lib/completions/ntpdate.exp new file mode 100644 index 00000000..6a6456f4 --- /dev/null +++ b/test/lib/completions/ntpdate.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "ntpdate -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/objcopy.exp b/test/lib/completions/objcopy.exp new file mode 100644 index 00000000..acb6539a --- /dev/null +++ b/test/lib/completions/objcopy.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "objcopy " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/objdump.exp b/test/lib/completions/objdump.exp new file mode 100644 index 00000000..5eec35d6 --- /dev/null +++ b/test/lib/completions/objdump.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "objdump " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/od.exp b/test/lib/completions/od.exp new file mode 100644 index 00000000..5838218c --- /dev/null +++ b/test/lib/completions/od.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "od " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/openssl.exp b/test/lib/completions/openssl.exp new file mode 100644 index 00000000..651e5e6d --- /dev/null +++ b/test/lib/completions/openssl.exp @@ -0,0 +1,28 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +set test "Tab should complete" + # Try completion +set cmd "openssl " +send "$cmd\t" +expect { + -re "^$cmd\r\n.*$cmd$" { pass "$test" } + -re /@ { unresolved "$test at prompt" } + -re eof { unresolved "eof" } +}; # expect + + +sync_after_int + + +teardown diff --git a/test/lib/completions/p4.exp b/test/lib/completions/p4.exp new file mode 100644 index 00000000..369d2c6b --- /dev/null +++ b/test/lib/completions/p4.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "p4 " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/pack200.exp b/test/lib/completions/pack200.exp new file mode 100644 index 00000000..f96eff13 --- /dev/null +++ b/test/lib/completions/pack200.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "pack200 " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/paste.exp b/test/lib/completions/paste.exp new file mode 100644 index 00000000..3a4e93be --- /dev/null +++ b/test/lib/completions/paste.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "paste " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/patch.exp b/test/lib/completions/patch.exp new file mode 100644 index 00000000..a44fa130 --- /dev/null +++ b/test/lib/completions/patch.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "patch " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/perl.exp b/test/lib/completions/perl.exp new file mode 100644 index 00000000..2199c994 --- /dev/null +++ b/test/lib/completions/perl.exp @@ -0,0 +1,95 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "perl " + + +sync_after_int + + +set test "Second argument should file complete" +set cmd "perl foo fixtures/shared/default/f" +send "$cmd\t" +expect { + -re "^$cmd\r\nfoo +foo.d/ *\r\n/@${cmd}oo$" { pass "$test" } + -re /@ { unresolved "$test at prompt" } + -re eof { unresolved "eof" } +} + + +sync_after_int + + +set test "-I without space should complete directories" +set cmd "perl -Ifixtures/shared/default/" +send "$cmd\t" +expect { + -re "^$cmd\r\nbar bar.d/ +foo.d/ *\r\n/@$cmd$" { pass "$test" } + -re /@ { unresolved "$test at prompt" } + -re eof { unresolved "eof" } +} + + +sync_after_int + + +set test "-I with space should complete directories" +set cmd "perl -I fixtures/shared/default/" +send "$cmd\t" +expect { + -re "^$cmd\r\nbar bar.d/ +foo.d/ *\r\n/@$cmd$" { pass "$test" } + -re /@ { unresolved "$test at prompt" } + -re eof { unresolved "eof" } +} + + +sync_after_int + + +set test "-x without space should complete directories" +set cmd "perl -xfixtures/shared/default/b" +send "$cmd\t" +expect { + -re "^${cmd}ar\\\\ bar.d/ *$" { pass "$test" } + -re /@ { unresolved "$test at prompt" } + -re eof { unresolved "eof" } +} + + +sync_after_int + + +set test "-x with space should complete directories" +set cmd "perl -x fixtures/shared/default/b" +send "$cmd\t" +expect { + -re "^${cmd}ar\\\\ bar.d/ *$" { pass "$test" } + -re /@ { unresolved "$test at prompt" } + -re eof { unresolved "eof" } +} + + +sync_after_int + + +set test "- should complete options" +set options { + -0 -a -c -C -d -D -e -F -h -i -I -l -m -M -n -p -P -s -S -T -u -U -v -V -w -W -x -X +} +assert_complete $options "perl -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/perldoc.exp b/test/lib/completions/perldoc.exp new file mode 100644 index 00000000..b3ff83b3 --- /dev/null +++ b/test/lib/completions/perldoc.exp @@ -0,0 +1,38 @@ +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" +expect { + # Assuming the module `File::Path' is always installed + -re "\\sPath\\s" { pass "$test" } + # Assuming there's no perl module named `fixtures', but only our directory + # `test/fixtures' which is presented falsely. + -re "\\sfixtures/\\s" { fail "$test" } + -re "perldoc File::File::" { fail "$test" } + -re /@ { unresolved "$test" } + default { unresolved "$test" } +}; # expect + + +sync_after_int + + +teardown diff --git a/test/lib/completions/pgrep.exp b/test/lib/completions/pgrep.exp new file mode 100644 index 00000000..63143acc --- /dev/null +++ b/test/lib/completions/pgrep.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "pgrep " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/pine.exp b/test/lib/completions/pine.exp new file mode 100644 index 00000000..0a0c3f40 --- /dev/null +++ b/test/lib/completions/pine.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "pine " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ping.exp b/test/lib/completions/ping.exp new file mode 100644 index 00000000..b600849b --- /dev/null +++ b/test/lib/completions/ping.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "ping " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/pkg-config.exp b/test/lib/completions/pkg-config.exp new file mode 100644 index 00000000..477dba08 --- /dev/null +++ b/test/lib/completions/pkg-config.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "pkg-config -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/pkg_deinstall.exp b/test/lib/completions/pkg_deinstall.exp new file mode 100644 index 00000000..8f3d8c3d --- /dev/null +++ b/test/lib/completions/pkg_deinstall.exp @@ -0,0 +1,22 @@ +proc setup {} { + assert_bash_exec {PKG_DBDIR=fixtures/pkgtools/db} + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +set pkgs [exec bash -c "cd fixtures/pkgtools/db ; compgen -d"] +assert_complete $pkgs "pkg_deinstall " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/pkg_delete.exp b/test/lib/completions/pkg_delete.exp new file mode 100644 index 00000000..b0c1a2a5 --- /dev/null +++ b/test/lib/completions/pkg_delete.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "pkg_delete " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/pkg_info.exp b/test/lib/completions/pkg_info.exp new file mode 100644 index 00000000..3f253ccf --- /dev/null +++ b/test/lib/completions/pkg_info.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "pkg_info " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/pkill.exp b/test/lib/completions/pkill.exp new file mode 100644 index 00000000..0333fc94 --- /dev/null +++ b/test/lib/completions/pkill.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "pkill " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/portinstall.exp b/test/lib/completions/portinstall.exp new file mode 100644 index 00000000..d70f5db6 --- /dev/null +++ b/test/lib/completions/portinstall.exp @@ -0,0 +1,22 @@ +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} + save_env +}; # setup() + + +proc teardown {} { + assert_bash_exec {rm fixtures/pkgtools/ports/INDEX fixtures/pkgtools/ports/INDEX-5} + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete "bash-2.05b.007_6 bash-3.1.17 bash-completion-20060301_2 shells/bash shells/bash-completion shells/bash2" "portinstall " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/portupgrade.exp b/test/lib/completions/portupgrade.exp new file mode 100644 index 00000000..cb583923 --- /dev/null +++ b/test/lib/completions/portupgrade.exp @@ -0,0 +1,21 @@ +proc setup {} { + assert_bash_exec {PKG_DBDIR=fixtures/pkgtools/db} + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete "a b-c-d" "portupgrade " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/povray.exp b/test/lib/completions/povray.exp new file mode 100644 index 00000000..1efeeddb --- /dev/null +++ b/test/lib/completions/povray.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "povray " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/pr.exp b/test/lib/completions/pr.exp new file mode 100644 index 00000000..5d7a96c3 --- /dev/null +++ b/test/lib/completions/pr.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "pr " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/psql.exp b/test/lib/completions/psql.exp new file mode 100644 index 00000000..56d56666 --- /dev/null +++ b/test/lib/completions/psql.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "psql -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ptx.exp b/test/lib/completions/ptx.exp new file mode 100644 index 00000000..2defe049 --- /dev/null +++ b/test/lib/completions/ptx.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "ptx " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/pvchange.exp b/test/lib/completions/pvchange.exp new file mode 100644 index 00000000..fd4b73d0 --- /dev/null +++ b/test/lib/completions/pvchange.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "pvchange --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/pvcreate.exp b/test/lib/completions/pvcreate.exp new file mode 100644 index 00000000..47cebf7a --- /dev/null +++ b/test/lib/completions/pvcreate.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "pvcreate --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/pvdisplay.exp b/test/lib/completions/pvdisplay.exp new file mode 100644 index 00000000..151064cd --- /dev/null +++ b/test/lib/completions/pvdisplay.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "pvdisplay --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/pvmove.exp b/test/lib/completions/pvmove.exp new file mode 100644 index 00000000..81c05e98 --- /dev/null +++ b/test/lib/completions/pvmove.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "pvmove --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/pvremove.exp b/test/lib/completions/pvremove.exp new file mode 100644 index 00000000..dd145bf6 --- /dev/null +++ b/test/lib/completions/pvremove.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "pvremove --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/pvs.exp b/test/lib/completions/pvs.exp new file mode 100644 index 00000000..6e5527e1 --- /dev/null +++ b/test/lib/completions/pvs.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "pvs --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/pvscan.exp b/test/lib/completions/pvscan.exp new file mode 100644 index 00000000..e92cdbe0 --- /dev/null +++ b/test/lib/completions/pvscan.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "pvscan --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/python.exp b/test/lib/completions/python.exp new file mode 100644 index 00000000..c9d70b43 --- /dev/null +++ b/test/lib/completions/python.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "python " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/qrunner.exp b/test/lib/completions/qrunner.exp new file mode 100644 index 00000000..b8fcf191 --- /dev/null +++ b/test/lib/completions/qrunner.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "qrunner -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/querybts.exp b/test/lib/completions/querybts.exp new file mode 100644 index 00000000..dc75cd62 --- /dev/null +++ b/test/lib/completions/querybts.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "querybts --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/rcs.exp b/test/lib/completions/rcs.exp new file mode 100644 index 00000000..19ae4d50 --- /dev/null +++ b/test/lib/completions/rcs.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "rcs " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/rcsdiff.exp b/test/lib/completions/rcsdiff.exp new file mode 100644 index 00000000..8383cdb9 --- /dev/null +++ b/test/lib/completions/rcsdiff.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "rcsdiff " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/rdict.exp b/test/lib/completions/rdict.exp new file mode 100644 index 00000000..aa132617 --- /dev/null +++ b/test/lib/completions/rdict.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "rdict --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/readelf.exp b/test/lib/completions/readelf.exp new file mode 100644 index 00000000..a084a41e --- /dev/null +++ b/test/lib/completions/readelf.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "readelf --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/readonly.exp b/test/lib/completions/readonly.exp new file mode 100644 index 00000000..84be3c96 --- /dev/null +++ b/test/lib/completions/readonly.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "readonly BASH_ARG" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/remove_members.exp b/test/lib/completions/remove_members.exp new file mode 100644 index 00000000..63d6a70e --- /dev/null +++ b/test/lib/completions/remove_members.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "remove_members --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/removepkg.exp b/test/lib/completions/removepkg.exp new file mode 100644 index 00000000..7cf98805 --- /dev/null +++ b/test/lib/completions/removepkg.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "removepkg " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/renice.exp b/test/lib/completions/renice.exp new file mode 100644 index 00000000..c91e0212 --- /dev/null +++ b/test/lib/completions/renice.exp @@ -0,0 +1,42 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +set test "Tab should show complete process ids" + # Try completion +set cmd "renice 1" +send "$cmd\t" +expect { + -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" } + -re /@ { unresolved "$test at prompt" } + -re eof { unresolved "eof" } +}; # expect + + +sync_after_int + + +set test "Tab should show complete process group ids" + # Try completion +set cmd "renice -g " +send "$cmd\t" +expect { + -re "$cmd\r\n\\d+.*/@$cmd$" { pass "$test" } + -re /@ { unresolved "$test at prompt" } + -re eof { unresolved "eof" } +}; # expect + + +sync_after_int + + +teardown diff --git a/test/lib/completions/reportbug.exp b/test/lib/completions/reportbug.exp new file mode 100644 index 00000000..1f66df2c --- /dev/null +++ b/test/lib/completions/reportbug.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "reportbug --m" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ri.exp b/test/lib/completions/ri.exp new file mode 100644 index 00000000..160dc9a7 --- /dev/null +++ b/test/lib/completions/ri.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "ri " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/rlog.exp b/test/lib/completions/rlog.exp new file mode 100644 index 00000000..cbc06857 --- /dev/null +++ b/test/lib/completions/rlog.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "rlog " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/rm.exp b/test/lib/completions/rm.exp new file mode 100644 index 00000000..ae670e83 --- /dev/null +++ b/test/lib/completions/rm.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "rm " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/rmdir.exp b/test/lib/completions/rmdir.exp new file mode 100644 index 00000000..2b23a9c5 --- /dev/null +++ b/test/lib/completions/rmdir.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "rmdir " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/rmlist.exp b/test/lib/completions/rmlist.exp new file mode 100644 index 00000000..91519ee8 --- /dev/null +++ b/test/lib/completions/rmlist.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "rmlist -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/rpcdebug.exp b/test/lib/completions/rpcdebug.exp new file mode 100644 index 00000000..8629c947 --- /dev/null +++ b/test/lib/completions/rpcdebug.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "rpcdebug -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/rpm.exp b/test/lib/completions/rpm.exp new file mode 100644 index 00000000..3ed154a9 --- /dev/null +++ b/test/lib/completions/rpm.exp @@ -0,0 +1,29 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "rpm " + + +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 + + +teardown diff --git a/test/lib/completions/rsync.exp b/test/lib/completions/rsync.exp new file mode 100644 index 00000000..fb301a35 --- /dev/null +++ b/test/lib/completions/rsync.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "rsync " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/rtcwake.exp b/test/lib/completions/rtcwake.exp new file mode 100644 index 00000000..0b9a974b --- /dev/null +++ b/test/lib/completions/rtcwake.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "rtcwake " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/sbcl-mt.exp b/test/lib/completions/sbcl-mt.exp new file mode 100644 index 00000000..45e81f79 --- /dev/null +++ b/test/lib/completions/sbcl-mt.exp @@ -0,0 +1,20 @@ +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/" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/sbcl.exp b/test/lib/completions/sbcl.exp new file mode 100644 index 00000000..b68b2dce --- /dev/null +++ b/test/lib/completions/sbcl.exp @@ -0,0 +1,20 @@ +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/" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/scp.exp b/test/lib/completions/scp.exp new file mode 100644 index 00000000..efe2b686 --- /dev/null +++ b/test/lib/completions/scp.exp @@ -0,0 +1,121 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified { + /BASH_LINENO=/d + /BASH_SOURCE=/d + /OLDPWD=/d + } +}; # teardown() + + +setup + + +set test "Tab should complete remote pwd" +set host bash_completion + + # Retrieving home directory (host_pwd) from ssh-host `bash_completion' + # yields error? +if { + [catch { + exec -- ssh -o "Batchmode yes" -o "ConnectTimeout 1" $host pwd 2>> /dev/null + } host_pwd] +} { + # Yes, retrieving pwd from ssh yields error; reset `host_pwd' + # Indicate host pwd is unknown and test is unsupported + # NOTE: To support this test, set the hostname "bash_completion" + # in `$HOME/.ssh/config' or `/etc/ssh_config' + set host_pwd "" + unsupported $test +}; # if + + + # Try completion +set cmd "scp $host:" +send "$cmd\t" +sync_after_tab +expect { + -re "^$cmd$host_pwd.*$" { pass "$test" } + -re /@ { unresolved "$test at prompt" } +}; # expect + + +sync_after_int + + +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 +set expected {} +foreach host [get_hosts] { + lappend expected "$host:" +}; # foreach +lappend expected 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 + + +sync_after_int + + +set test "-F without space shouldn't error" + # Try completion +set cmd "scp -F" +send "$cmd\t " +expect { + -re "^${cmd}bash: option requires an argument -- F" { fail "$test" } + -re "^$cmd\r\n.*\r\n/@" { pass "$test" } + -re /@ { unresolved "$test at prompt" } + default { unresolved "$test" } +}; # expect + + +sync_after_int + + +set test "Config file containing space should work" + # Build string list of expected completions + # Get hostnames and give them a colon (:) suffix +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: + # 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]} { + expect { + -re $prompt { 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 +assert_bash_exec {cd "$TESTDIR"} + + +sync_after_int + + +teardown diff --git a/test/lib/completions/screen.exp b/test/lib/completions/screen.exp new file mode 100644 index 00000000..985862c1 --- /dev/null +++ b/test/lib/completions/screen.exp @@ -0,0 +1,52 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified {/OLDPWD=/d} +}; # teardown() + + +setup + + +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"} + + + +sync_after_int + + +teardown diff --git a/test/lib/completions/sed.exp b/test/lib/completions/sed.exp new file mode 100644 index 00000000..8764cfb8 --- /dev/null +++ b/test/lib/completions/sed.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {sed --help} "" "" "unsupported"]} { + assert_complete_any "sed --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/seq.exp b/test/lib/completions/seq.exp new file mode 100644 index 00000000..b5333ef9 --- /dev/null +++ b/test/lib/completions/seq.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "seq --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/service.exp b/test/lib/completions/service.exp new file mode 100644 index 00000000..917c5dcb --- /dev/null +++ b/test/lib/completions/service.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "service " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/set.exp b/test/lib/completions/set.exp new file mode 100644 index 00000000..2b2d40e9 --- /dev/null +++ b/test/lib/completions/set.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "set no" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/sftp.exp b/test/lib/completions/sftp.exp new file mode 100644 index 00000000..24c37cb5 --- /dev/null +++ b/test/lib/completions/sftp.exp @@ -0,0 +1,77 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified { + /BASH_LINENO=/d + /BASH_SOURCE=/d + /OLDPWD=/d + } +}; # teardown() + + +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 + + +sync_after_int + + +set test "-F without space shouldn't error" + # Try completion +set cmd "sftp -F" +send "$cmd\t " +expect { + -re "^${cmd}bash: option requires an argument -- F" { fail "$test" } + -re "^$cmd\r\n.*\r\n/@" { pass "$test" } + -re /@ { unresolved "$test at prompt" } + default { unresolved "$test" } +}; # expect + + +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 + + +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"} + + +teardown diff --git a/test/lib/completions/sha1sum.exp b/test/lib/completions/sha1sum.exp new file mode 100644 index 00000000..17519087 --- /dev/null +++ b/test/lib/completions/sha1sum.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "sha1sum --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/shar.exp b/test/lib/completions/shar.exp new file mode 100644 index 00000000..7ace9d6e --- /dev/null +++ b/test/lib/completions/shar.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "shar --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/sitecopy.exp b/test/lib/completions/sitecopy.exp new file mode 100644 index 00000000..49b78918 --- /dev/null +++ b/test/lib/completions/sitecopy.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "sitecopy --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/smartctl.exp b/test/lib/completions/smartctl.exp new file mode 100644 index 00000000..a9eeb956 --- /dev/null +++ b/test/lib/completions/smartctl.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "smartctl --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/snownews.exp b/test/lib/completions/snownews.exp new file mode 100644 index 00000000..7502e587 --- /dev/null +++ b/test/lib/completions/snownews.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "snownews --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/sort.exp b/test/lib/completions/sort.exp new file mode 100644 index 00000000..20516cc8 --- /dev/null +++ b/test/lib/completions/sort.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "sort --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/split.exp b/test/lib/completions/split.exp new file mode 100644 index 00000000..b74da369 --- /dev/null +++ b/test/lib/completions/split.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {split --help} "" "" "unsupported"]} { + assert_complete_any "split --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/spovray.exp b/test/lib/completions/spovray.exp new file mode 100644 index 00000000..30d81853 --- /dev/null +++ b/test/lib/completions/spovray.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "spovray " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ssh.exp b/test/lib/completions/ssh.exp new file mode 100644 index 00000000..91955c1d --- /dev/null +++ b/test/lib/completions/ssh.exp @@ -0,0 +1,93 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified { + /BASH_LINENO=/d + /BASH_SOURCE=/d + /OLDPWD=/d + } +}; # teardown() + + +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$" +expect { + -re $expected { pass "$test" } + -re $prompt { unresolved "$test at prompt" } + default { unresolved "$test" } +}; # expect +sync_after_int $prompt +assert_bash_exec {cd "$TESTDIR"} + + +sync_after_int + + +set test "-F without space shouldn't error" + # Try completion +set cmd "ssh -F" +send "$cmd\t " +set expected "^$cmd $" +expect { + -re "^${cmd}bash: option requires an argument -- F" { fail "$test" } + -re "^$cmd\r\n.*\r\n/@" { pass "$test" } + -re /@ { unresolved "$test at prompt" } + default { unresolved "$test" } +}; # expect + + +sync_after_int + + +set test "First argument shouldn't complete with commands" +# NOTE: This test assumes there's a command "bash" and no host named "bash" +set cmd "ssh bas" +assert_complete [get_known_hosts "bas"] $cmd $test + + +sync_after_int + + +set test "First argument should complete partial hostname" +assert_complete_partial [get_hosts] ssh "" $test /@ 20 \ + [list "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"} + + +sync_after_int + + +teardown diff --git a/test/lib/completions/sshmitm.exp b/test/lib/completions/sshmitm.exp new file mode 100644 index 00000000..b8f8a2c9 --- /dev/null +++ b/test/lib/completions/sshmitm.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "sshmitm -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/sshow.exp b/test/lib/completions/sshow.exp new file mode 100644 index 00000000..36a6cc2c --- /dev/null +++ b/test/lib/completions/sshow.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "sshow -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/strace.exp b/test/lib/completions/strace.exp new file mode 100644 index 00000000..55004d20 --- /dev/null +++ b/test/lib/completions/strace.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "strace -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/strip.exp b/test/lib/completions/strip.exp new file mode 100644 index 00000000..46d9f362 --- /dev/null +++ b/test/lib/completions/strip.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "strip --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/sudo.exp b/test/lib/completions/sudo.exp new file mode 100644 index 00000000..1299a6da --- /dev/null +++ b/test/lib/completions/sudo.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete "fixtures/shared/default/foo.d/" "sudo cd fixtures/shared/default/fo" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/svk.exp b/test/lib/completions/svk.exp new file mode 100644 index 00000000..a08674dc --- /dev/null +++ b/test/lib/completions/svk.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "svk " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/svn.exp b/test/lib/completions/svn.exp new file mode 100644 index 00000000..fe40d6f7 --- /dev/null +++ b/test/lib/completions/svn.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "svn " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/svnadmin.exp b/test/lib/completions/svnadmin.exp new file mode 100644 index 00000000..35e07021 --- /dev/null +++ b/test/lib/completions/svnadmin.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "svnadmin " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/svnlook.exp b/test/lib/completions/svnlook.exp new file mode 100644 index 00000000..33b67052 --- /dev/null +++ b/test/lib/completions/svnlook.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "svnlook " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/sync_members.exp b/test/lib/completions/sync_members.exp new file mode 100644 index 00000000..4cb84ad8 --- /dev/null +++ b/test/lib/completions/sync_members.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "sync_members --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/sysctl.exp b/test/lib/completions/sysctl.exp new file mode 100644 index 00000000..e1866f55 --- /dev/null +++ b/test/lib/completions/sysctl.exp @@ -0,0 +1,22 @@ +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 + + +sync_after_int + + +teardown diff --git a/test/lib/completions/tac.exp b/test/lib/completions/tac.exp new file mode 100644 index 00000000..21230052 --- /dev/null +++ b/test/lib/completions/tac.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "tac --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/tail.exp b/test/lib/completions/tail.exp new file mode 100644 index 00000000..c8a82d97 --- /dev/null +++ b/test/lib/completions/tail.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {tail --help} "" "" "unsupported"]} { + assert_complete_any "tail --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/tar.exp b/test/lib/completions/tar.exp new file mode 100644 index 00000000..43c60ff9 --- /dev/null +++ b/test/lib/completions/tar.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "tar " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/tcpkill.exp b/test/lib/completions/tcpkill.exp new file mode 100644 index 00000000..e8cc9c10 --- /dev/null +++ b/test/lib/completions/tcpkill.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "tcpkill -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/tcpnice.exp b/test/lib/completions/tcpnice.exp new file mode 100644 index 00000000..44bb59c6 --- /dev/null +++ b/test/lib/completions/tcpnice.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "tcpnice -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/tee.exp b/test/lib/completions/tee.exp new file mode 100644 index 00000000..c25057ba --- /dev/null +++ b/test/lib/completions/tee.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "tee " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/texindex.exp b/test/lib/completions/texindex.exp new file mode 100644 index 00000000..d5b8cd77 --- /dev/null +++ b/test/lib/completions/texindex.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "texindex --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/tightvncviewer.exp b/test/lib/completions/tightvncviewer.exp new file mode 100644 index 00000000..6eba24c2 --- /dev/null +++ b/test/lib/completions/tightvncviewer.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "tightvncviewer " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/time.exp b/test/lib/completions/time.exp new file mode 100644 index 00000000..b114318b --- /dev/null +++ b/test/lib/completions/time.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "time set" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/touch.exp b/test/lib/completions/touch.exp new file mode 100644 index 00000000..f0960ef7 --- /dev/null +++ b/test/lib/completions/touch.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {touch --help} "" "" "unsupported"]} { + assert_complete_any "touch --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/tr.exp b/test/lib/completions/tr.exp new file mode 100644 index 00000000..68b11a36 --- /dev/null +++ b/test/lib/completions/tr.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {tr --help} "" "" "unsupported"]} { + assert_complete_any "tr --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/unace.exp b/test/lib/completions/unace.exp new file mode 100644 index 00000000..0afbaafb --- /dev/null +++ b/test/lib/completions/unace.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "unace -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/uname.exp b/test/lib/completions/uname.exp new file mode 100644 index 00000000..2179dafd --- /dev/null +++ b/test/lib/completions/uname.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {uname --help} "" "" "unsupported"]} { + assert_complete_any "uname --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/unexpand.exp b/test/lib/completions/unexpand.exp new file mode 100644 index 00000000..31822561 --- /dev/null +++ b/test/lib/completions/unexpand.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {unexpand --help} "" "" "unsupported"]} { + assert_complete_any "unexpand --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/uniq.exp b/test/lib/completions/uniq.exp new file mode 100644 index 00000000..20dbcfac --- /dev/null +++ b/test/lib/completions/uniq.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {uniq --help} "" "" "unsupported"]} { + assert_complete_any "uniq --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/units.exp b/test/lib/completions/units.exp new file mode 100644 index 00000000..a40b5f3f --- /dev/null +++ b/test/lib/completions/units.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {units --help} "" "" "unsupported"]} { + assert_complete_any "units --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/unpack200.exp b/test/lib/completions/unpack200.exp new file mode 100644 index 00000000..845701dd --- /dev/null +++ b/test/lib/completions/unpack200.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "unpack200 " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/unrar.exp b/test/lib/completions/unrar.exp new file mode 100644 index 00000000..e66e3c8b --- /dev/null +++ b/test/lib/completions/unrar.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "unrar -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/unset.exp b/test/lib/completions/unset.exp new file mode 100644 index 00000000..a5e7fc9b --- /dev/null +++ b/test/lib/completions/unset.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "unset BASH_ARG" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/unshunt.exp b/test/lib/completions/unshunt.exp new file mode 100644 index 00000000..964cac68 --- /dev/null +++ b/test/lib/completions/unshunt.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "unshunt -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/update-alternatives.exp b/test/lib/completions/update-alternatives.exp new file mode 100644 index 00000000..10ff4e6d --- /dev/null +++ b/test/lib/completions/update-alternatives.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "update-alternatives --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/update-rc.d.exp b/test/lib/completions/update-rc.d.exp new file mode 100644 index 00000000..9c2c2464 --- /dev/null +++ b/test/lib/completions/update-rc.d.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "update-rc.d -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/urlsnarf.exp b/test/lib/completions/urlsnarf.exp new file mode 100644 index 00000000..c5b26922 --- /dev/null +++ b/test/lib/completions/urlsnarf.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "urlsnarf -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vdir.exp b/test/lib/completions/vdir.exp new file mode 100644 index 00000000..b525c382 --- /dev/null +++ b/test/lib/completions/vdir.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vdir " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgcfgbackup.exp b/test/lib/completions/vgcfgbackup.exp new file mode 100644 index 00000000..19ceeeca --- /dev/null +++ b/test/lib/completions/vgcfgbackup.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgcfgbackup -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgcfgrestore.exp b/test/lib/completions/vgcfgrestore.exp new file mode 100644 index 00000000..e1c3c3b9 --- /dev/null +++ b/test/lib/completions/vgcfgrestore.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgcfgrestore -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgchange.exp b/test/lib/completions/vgchange.exp new file mode 100644 index 00000000..645eedb4 --- /dev/null +++ b/test/lib/completions/vgchange.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgchange -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgck.exp b/test/lib/completions/vgck.exp new file mode 100644 index 00000000..67209b15 --- /dev/null +++ b/test/lib/completions/vgck.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgck -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgconvert.exp b/test/lib/completions/vgconvert.exp new file mode 100644 index 00000000..065c4828 --- /dev/null +++ b/test/lib/completions/vgconvert.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgconvert -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgcreate.exp b/test/lib/completions/vgcreate.exp new file mode 100644 index 00000000..7c324e62 --- /dev/null +++ b/test/lib/completions/vgcreate.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgcreate -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgdisplay.exp b/test/lib/completions/vgdisplay.exp new file mode 100644 index 00000000..b6bc9125 --- /dev/null +++ b/test/lib/completions/vgdisplay.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgdisplay -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgexport.exp b/test/lib/completions/vgexport.exp new file mode 100644 index 00000000..2ad4230e --- /dev/null +++ b/test/lib/completions/vgexport.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgexport -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgextend.exp b/test/lib/completions/vgextend.exp new file mode 100644 index 00000000..18a491d2 --- /dev/null +++ b/test/lib/completions/vgextend.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgextend -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgimport.exp b/test/lib/completions/vgimport.exp new file mode 100644 index 00000000..e4568f3b --- /dev/null +++ b/test/lib/completions/vgimport.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgimport -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgmerge.exp b/test/lib/completions/vgmerge.exp new file mode 100644 index 00000000..8ba5e893 --- /dev/null +++ b/test/lib/completions/vgmerge.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgmerge -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgmknodes.exp b/test/lib/completions/vgmknodes.exp new file mode 100644 index 00000000..d24552f0 --- /dev/null +++ b/test/lib/completions/vgmknodes.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgmknodes -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgreduce.exp b/test/lib/completions/vgreduce.exp new file mode 100644 index 00000000..887ba8de --- /dev/null +++ b/test/lib/completions/vgreduce.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgreduce -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgremove.exp b/test/lib/completions/vgremove.exp new file mode 100644 index 00000000..26dadf95 --- /dev/null +++ b/test/lib/completions/vgremove.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgremove -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgrename.exp b/test/lib/completions/vgrename.exp new file mode 100644 index 00000000..8ddaa758 --- /dev/null +++ b/test/lib/completions/vgrename.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgrename -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgs.exp b/test/lib/completions/vgs.exp new file mode 100644 index 00000000..a27e3650 --- /dev/null +++ b/test/lib/completions/vgs.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgs -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgscan.exp b/test/lib/completions/vgscan.exp new file mode 100644 index 00000000..4bb8c35e --- /dev/null +++ b/test/lib/completions/vgscan.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgscan -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vgsplit.exp b/test/lib/completions/vgsplit.exp new file mode 100644 index 00000000..54e7034f --- /dev/null +++ b/test/lib/completions/vgsplit.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "vgsplit -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vncviewer.exp b/test/lib/completions/vncviewer.exp new file mode 100644 index 00000000..3d47f49f --- /dev/null +++ b/test/lib/completions/vncviewer.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified { + /declare -f _vncviewer_bootstrap/d + } +}; # teardown() + + +setup + + +assert_complete_any "vncviewer " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/wc.exp b/test/lib/completions/wc.exp new file mode 100644 index 00000000..8ad2bf8d --- /dev/null +++ b/test/lib/completions/wc.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {wc --help} "" "" "unsupported"]} { + assert_complete_any "wc --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/webmitm.exp b/test/lib/completions/webmitm.exp new file mode 100644 index 00000000..1d48a3a6 --- /dev/null +++ b/test/lib/completions/webmitm.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "webmitm -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/wget.exp b/test/lib/completions/wget.exp new file mode 100644 index 00000000..245b27be --- /dev/null +++ b/test/lib/completions/wget.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "wget --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/who.exp b/test/lib/completions/who.exp new file mode 100644 index 00000000..73928ef7 --- /dev/null +++ b/test/lib/completions/who.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +if {[assert_exec {who --help} "" "" "unsupported"]} { + assert_complete_any "who --" +}; # if + + +sync_after_int + + +teardown diff --git a/test/lib/completions/withlist.exp b/test/lib/completions/withlist.exp new file mode 100644 index 00000000..6310466d --- /dev/null +++ b/test/lib/completions/withlist.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "withlist --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/wol.exp b/test/lib/completions/wol.exp new file mode 100644 index 00000000..84a2d88d --- /dev/null +++ b/test/lib/completions/wol.exp @@ -0,0 +1,29 @@ +proc setup {} { + # See fixtures/shared/bin/{arp,ifconfig} + assert_bash_exec {OLDPATH="$PATH"; PATH="$TESTDIR/fixtures/shared/bin:$PATH";} + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified + assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH} +}; # teardown() + + +setup + + +assert_complete "00:00:00:00:00:00 11:11:11:11:11:11 22:22:22:22:22:22 33:33:33:33:33:33" "wol " + + +sync_after_int + + +assert_complete "00:00:00:00:00:00" "wol 00:" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/wtf.exp b/test/lib/completions/wtf.exp new file mode 100644 index 00000000..8250becc --- /dev/null +++ b/test/lib/completions/wtf.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "wtf " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/wvdial.exp b/test/lib/completions/wvdial.exp new file mode 100644 index 00000000..8d4669de --- /dev/null +++ b/test/lib/completions/wvdial.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "wvdial -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/xhost.exp b/test/lib/completions/xhost.exp new file mode 100644 index 00000000..aeceadb6 --- /dev/null +++ b/test/lib/completions/xhost.exp @@ -0,0 +1,100 @@ +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 + + +sync_after_int + + +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"] { + 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 + + +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"] { + lappend hosts "+$h" +}; # foreach +assert_complete $hosts "xhost \+" $test + + +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"] { + 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" + + +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"] { + lappend hosts "-$h" +}; # foreach +assert_complete $hosts "xhost -" $test + + +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"] { + 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 + + +sync_after_int + + +teardown diff --git a/test/lib/completions/xmllint.exp b/test/lib/completions/xmllint.exp new file mode 100644 index 00000000..15451471 --- /dev/null +++ b/test/lib/completions/xmllint.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "xmllint " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/xmlwf.exp b/test/lib/completions/xmlwf.exp new file mode 100644 index 00000000..a996d458 --- /dev/null +++ b/test/lib/completions/xmlwf.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "xmlwf " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/xmms.exp b/test/lib/completions/xmms.exp new file mode 100644 index 00000000..c4ad64e8 --- /dev/null +++ b/test/lib/completions/xmms.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "xmms --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/xpovray.exp b/test/lib/completions/xpovray.exp new file mode 100644 index 00000000..92cc903d --- /dev/null +++ b/test/lib/completions/xpovray.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "xpovray " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/xrandr.exp b/test/lib/completions/xrandr.exp new file mode 100644 index 00000000..649ed43b --- /dev/null +++ b/test/lib/completions/xrandr.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "xrandr " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/xsltproc.exp b/test/lib/completions/xsltproc.exp new file mode 100644 index 00000000..2470c22e --- /dev/null +++ b/test/lib/completions/xsltproc.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "xsltproc " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/xvnc4viewer.exp b/test/lib/completions/xvnc4viewer.exp new file mode 100644 index 00000000..3456c3e7 --- /dev/null +++ b/test/lib/completions/xvnc4viewer.exp @@ -0,0 +1,45 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +set test "Tab should complete options" +set options { + -AcceptClipboard -AutoSelect -DebugDelay -display + -DotWhenNoCursor -FullColor -FullColour -FullScreen + -geometry -help -listen -Log + -LowColourLevel -MenuKey -name -Parent + -passwd -PasswordFile -PointerEventInterval -PreferredEncoding + -SendClipboard -SendPrimary -Shared -UseLocalCursor + -via -ViewOnly -WMDecorationHeight -WMDecorationWidth + -ZlibLevel +} +assert_complete $options {vncviewer -} + + +sync_after_int + + +set expected {hextile raw zrle} +assert_complete $expected "xvnc4viewer -PreferredEncoding " + + +sync_after_int + + +set expected {hextile raw zrle} +assert_complete $expected "xvnc4viewer --preferredencoding " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/xz.exp b/test/lib/completions/xz.exp new file mode 100644 index 00000000..820b0689 --- /dev/null +++ b/test/lib/completions/xz.exp @@ -0,0 +1,33 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "xz " + + +sync_after_int + + +assert_complete "a/ bashcomp.lzma bashcomp.tar.xz bashcomp.tlz bashcomp.xz" \ + "xz -d fixtures/xz/" + + +sync_after_int + + +assert_complete "a/ bashcomp.tar" "xz fixtures/xz/" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ypcat.exp b/test/lib/completions/ypcat.exp new file mode 100644 index 00000000..f1bd0c0e --- /dev/null +++ b/test/lib/completions/ypcat.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "ypcat " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ypmatch.exp b/test/lib/completions/ypmatch.exp new file mode 100644 index 00000000..f1695f67 --- /dev/null +++ b/test/lib/completions/ypmatch.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "ypmatch foo " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/yum-arch.exp b/test/lib/completions/yum-arch.exp new file mode 100644 index 00000000..defb7bf4 --- /dev/null +++ b/test/lib/completions/yum-arch.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "yum-arch -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/yum.exp b/test/lib/completions/yum.exp new file mode 100644 index 00000000..09d7282c --- /dev/null +++ b/test/lib/completions/yum.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "yum -" + + +sync_after_int + + +teardown |