diff options
Diffstat (limited to 'test/lib')
| -rw-r--r-- | test/lib/completions/ccache.exp | 18 | ||||
| -rw-r--r-- | test/lib/completions/cppcheck.exp | 12 | ||||
| -rw-r--r-- | test/lib/completions/desktop-file-validate.exp | 20 | ||||
| -rw-r--r-- | test/lib/completions/export.exp | 55 | ||||
| -rw-r--r-- | test/lib/completions/htop.exp | 20 | ||||
| -rw-r--r-- | test/lib/completions/iperf.exp | 20 | ||||
| -rw-r--r-- | test/lib/completions/killall.exp | 2 | ||||
| -rw-r--r-- | test/lib/completions/koji.exp | 22 | ||||
| -rw-r--r-- | test/lib/completions/lzip.exp | 20 | ||||
| -rw-r--r-- | test/lib/completions/make.exp | 29 | ||||
| -rw-r--r-- | test/lib/completions/nethogs.exp | 20 | ||||
| -rw-r--r-- | test/lib/completions/perldoc.exp | 9 | ||||
| -rw-r--r-- | test/lib/completions/pidof.exp | 20 | ||||
| -rw-r--r-- | test/lib/completions/plague-client.exp | 20 | ||||
| -rw-r--r-- | test/lib/completions/ssh.exp | 2 | ||||
| -rw-r--r-- | test/lib/completions/udevadm.exp | 20 | ||||
| -rw-r--r-- | test/lib/completions/umount.exp | 20 | ||||
| -rw-r--r-- | test/lib/completions/upgradepkg.exp | 12 | ||||
| -rw-r--r-- | test/lib/completions/valgrind.exp | 50 | ||||
| -rw-r--r-- | test/lib/completions/vi.exp | 22 | ||||
| -rw-r--r-- | test/lib/completions/wine.exp | 31 | ||||
| -rw-r--r-- | test/lib/library.exp | 7 |
22 files changed, 436 insertions, 15 deletions
diff --git a/test/lib/completions/ccache.exp b/test/lib/completions/ccache.exp new file mode 100644 index 00000000..156c881a --- /dev/null +++ b/test/lib/completions/ccache.exp @@ -0,0 +1,18 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "ccache -" +sync_after_int + + +teardown diff --git a/test/lib/completions/cppcheck.exp b/test/lib/completions/cppcheck.exp index 4acd709a..80b6e7b6 100644 --- a/test/lib/completions/cppcheck.exp +++ b/test/lib/completions/cppcheck.exp @@ -27,4 +27,16 @@ assert_no_complete "cppcheck -D " sync_after_int +assert_complete "--enable=all" "cppcheck --enable=al" +sync_after_int + + +assert_complete "--enable=xx,style" "cppcheck --enable=xx,styl" +sync_after_int + + +assert_complete "--enable=xx,yy,style" "cppcheck --enable=xx,yy,styl" +sync_after_int + + teardown diff --git a/test/lib/completions/desktop-file-validate.exp b/test/lib/completions/desktop-file-validate.exp new file mode 100644 index 00000000..40cbf82f --- /dev/null +++ b/test/lib/completions/desktop-file-validate.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "desktop-file-validate " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/export.exp b/test/lib/completions/export.exp new file mode 100644 index 00000000..84cb9170 --- /dev/null +++ b/test/lib/completions/export.exp @@ -0,0 +1,55 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified { + /OLDPWD=/d + } +} + + +setup + + +assert_complete_any "export BASH" +sync_after_int + + +assert_complete_any "export -n BASH" +sync_after_int + + +assert_no_complete "export -p " +sync_after_int + + +assert_complete_dir {bar "bar bar.d/" foo foo.d/} "export FOO=" \ + fixtures/shared/default +sync_after_int + + +assert_complete_dir {foo foo.d/} "export FOO=f" fixtures/shared/default "" \ + -expect-cmd-minus f +sync_after_int + + +# Functions: _export, _expand, ... +assert_complete_any "export -fn _ex" +sync_after_int + + +assert_complete_any "export -f -n _ex" +sync_after_int + + +assert_complete_any "export FOO=\$BASH" +sync_after_int + + +assert_complete_any "export -" +sync_after_int + + +teardown diff --git a/test/lib/completions/htop.exp b/test/lib/completions/htop.exp new file mode 100644 index 00000000..d3e94d10 --- /dev/null +++ b/test/lib/completions/htop.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "htop -" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/iperf.exp b/test/lib/completions/iperf.exp new file mode 100644 index 00000000..66a0ba3b --- /dev/null +++ b/test/lib/completions/iperf.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "iperf " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/killall.exp b/test/lib/completions/killall.exp index 1ee3ade8..feec9337 100644 --- a/test/lib/completions/killall.exp +++ b/test/lib/completions/killall.exp @@ -17,7 +17,7 @@ assert_complete_any "killall " sync_after_int -assert_complete [get_signals -] "killall -" +assert_complete [get_signals] "killall --signal " sync_after_int diff --git a/test/lib/completions/koji.exp b/test/lib/completions/koji.exp new file mode 100644 index 00000000..a9673807 --- /dev/null +++ b/test/lib/completions/koji.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "koji " +sync_after_int + + +assert_complete_any "koji -" +sync_after_int + + +teardown diff --git a/test/lib/completions/lzip.exp b/test/lib/completions/lzip.exp new file mode 100644 index 00000000..fd92af62 --- /dev/null +++ b/test/lib/completions/lzip.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "lzip " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/make.exp b/test/lib/completions/make.exp index 64a393da..977485d2 100644 --- a/test/lib/completions/make.exp +++ b/test/lib/completions/make.exp @@ -4,14 +4,39 @@ proc setup {} { proc teardown {} { - assert_env_unmodified + assert_env_unmodified {/OLDPWD=/d} } setup -assert_complete_any "make " +set test "-f Ma<TAB> should complete \"Makefile\"" +set dir $::srcdir/fixtures/make +assert_complete_dir "Makefile" "make -f Ma" $dir $test + + +sync_after_int + + +set test "\"make <TAB>\" should complete targets" +set dir $::srcdir/fixtures/make +set targets "all sample install clean" +assert_complete_dir $targets "make " $dir $test + + +sync_after_int + + +set test "\"make <TAB>\" should not show anything in directory without makefile" +set dir $::srcdir/fixtures/make/empty_dir +assert_complete_dir "" "make " $dir $test + + +sync_after_int + + +assert_complete_any "make -j " sync_after_int diff --git a/test/lib/completions/nethogs.exp b/test/lib/completions/nethogs.exp new file mode 100644 index 00000000..d6234070 --- /dev/null +++ b/test/lib/completions/nethogs.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "nethogs " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/perldoc.exp b/test/lib/completions/perldoc.exp index 9a9d9fbf..a745b55d 100644 --- a/test/lib/completions/perldoc.exp +++ b/test/lib/completions/perldoc.exp @@ -24,17 +24,10 @@ expect { -re /@ { unresolved "$test" } default { unresolved "$test" } } - - sync_after_int -set test "- should complete options" -set options { - -h -v -t -u -m -l -F -X -f -q -} -assert_complete $options "perldoc -" $test - +assert_complete_any "perldoc -" sync_after_int diff --git a/test/lib/completions/pidof.exp b/test/lib/completions/pidof.exp new file mode 100644 index 00000000..8fdab978 --- /dev/null +++ b/test/lib/completions/pidof.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "pidof " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/plague-client.exp b/test/lib/completions/plague-client.exp new file mode 100644 index 00000000..ddcc8491 --- /dev/null +++ b/test/lib/completions/plague-client.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "plague-client " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/ssh.exp b/test/lib/completions/ssh.exp index 1599dccc..3ef0bb69 100644 --- a/test/lib/completions/ssh.exp +++ b/test/lib/completions/ssh.exp @@ -60,7 +60,7 @@ sync_after_int set test "First argument should complete partial hostname" -assert_complete_partial [get_hosts] ssh "" $test -ltrim-colon-completions +assert_complete_partial [get_known_hosts] ssh "l" $test -ltrim-colon-completions sync_after_int diff --git a/test/lib/completions/udevadm.exp b/test/lib/completions/udevadm.exp new file mode 100644 index 00000000..bef16f0b --- /dev/null +++ b/test/lib/completions/udevadm.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "udevadm " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/umount.exp b/test/lib/completions/umount.exp new file mode 100644 index 00000000..21a2dfa5 --- /dev/null +++ b/test/lib/completions/umount.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "umount " + + +sync_after_int + + +teardown diff --git a/test/lib/completions/upgradepkg.exp b/test/lib/completions/upgradepkg.exp index 860dde9e..4783aec3 100644 --- a/test/lib/completions/upgradepkg.exp +++ b/test/lib/completions/upgradepkg.exp @@ -36,4 +36,16 @@ assert_complete_dir $files "upgradepkg " $dir $test sync_after_int +set test "should complete *.t\[gbxl\]z files and dirs after % sign" +set oldpkg "xx-2.0-i486-2" +set dir $::srcdir/fixtures/slackware/home +set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \ + \\( -type d -printf '$oldpkg%%%P/\\n' \\) -o \ + \\( -type f -name '*.t\[bglx\]z' -printf '$oldpkg%%%P\\n' \\)"] "\n"] +assert_complete_dir $files "upgradepkg $oldpkg%" $dir $test + + +sync_after_int + + teardown diff --git a/test/lib/completions/valgrind.exp b/test/lib/completions/valgrind.exp new file mode 100644 index 00000000..6e3702b6 --- /dev/null +++ b/test/lib/completions/valgrind.exp @@ -0,0 +1,50 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified {/OLDPWD=/d} +} + + +setup + + +# b: assuming we have at least bash that starts with b in $PATH +assert_complete_any "valgrind b" + + +sync_after_int + + +assert_complete_any "valgrind -" + + +sync_after_int + + +set test "--tool=memche<TAB> should complete \"memcheck\"" +assert_complete "--tool=memcheck" "valgrind --tool=memche" $test + + +sync_after_int + + +set test "--tool=helgrind --history-l<TAB> should complete \"--history-level=\"" +assert_complete "--history-level=" "valgrind --tool=helgrind --history-l" $test -nospace + + +sync_after_int + + +set test "it should be possible to complete file paths" +set dir $::srcdir/fixtures/shared +set files [split [exec bash -c "cd $dir/bin && ls -p"] "\n"] +assert_complete_dir $files "valgrind --log-file=v\\ 0.log ./bin/" $dir $test + + +sync_after_int + + +teardown diff --git a/test/lib/completions/vi.exp b/test/lib/completions/vi.exp new file mode 100644 index 00000000..db3e3deb --- /dev/null +++ b/test/lib/completions/vi.exp @@ -0,0 +1,22 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "vi " +sync_after_int + + +assert_complete {libfoo.conf foo.txt} "vi $::srcdir/fixtures/shared/ld.so.conf.d/" +sync_after_int + + +teardown diff --git a/test/lib/completions/wine.exp b/test/lib/completions/wine.exp new file mode 100644 index 00000000..2cc60c48 --- /dev/null +++ b/test/lib/completions/wine.exp @@ -0,0 +1,31 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified {/OLDPWD=/d} +} + + +setup + + +set test "should complete *.exe, *.com files and dirs" +set dir $::srcdir/fixtures/shared/default +assert_complete_dir {"bar bar.d/" foo.d/} "wine " $dir $test + + +sync_after_int + + +set test "should complete any files and dirs after executable" +set dir $::srcdir/fixtures/shared/default +set files {bar "bar bar.d/" foo foo.d/} +assert_complete_dir $files "wine notepad " $dir $test + + +sync_after_int + + +teardown diff --git a/test/lib/library.exp b/test/lib/library.exp index f6e9f21a..b2233258 100644 --- a/test/lib/library.exp +++ b/test/lib/library.exp @@ -357,8 +357,9 @@ proc assert_complete_any {cmd {test ""} {prompt /@}} { } -# Make sure the expected files are returned by TAB-completing the -# specified command in the specified subdirectory. +# Make sure the expected files are returned by TAB-completing the specified +# command in the specified subdirectory. Be prepared to filter out OLDPWD +# changes when calling assert_env_unmodified() after using this procedure. # @param list $expected # @param string $cmd Command given to generate items # @param string $dir Subdirectory to attempt completion in. The directory must be relative from the $TESTDIR and without a trailing slash. E.g. `fixtures/evince' @@ -368,7 +369,7 @@ proc assert_complete_any {cmd {test ""} {prompt /@}} { proc assert_complete_dir {expected cmd dir {test ""} {args {}}} { set prompt "/@" assert_bash_exec "cd $dir" "" $prompt - assert_complete $expected $cmd $test $args + eval assert_complete \$expected \$cmd \$test $args sync_after_int $prompt assert_bash_exec {cd "$TESTDIR"} } |
