diff --git a/test/completion/explodepkg.exp b/test/completion/explodepkg.exp new file mode 100644 index 00000000..7d6ce793 --- /dev/null +++ b/test/completion/explodepkg.exp @@ -0,0 +1 @@ +assert_source_completions explodepkg diff --git a/test/fixtures/slackware/home/abc-4-i686-1.txz b/test/fixtures/slackware/home/abc-4-i686-1.txz new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/fixtures/slackware/home/abc-4-i686-1.txz @@ -0,0 +1 @@ + diff --git a/test/fixtures/slackware/home/opq-1.0-2.i386.rpm b/test/fixtures/slackware/home/opq-1.0-2.i386.rpm new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/fixtures/slackware/home/opq-1.0-2.i386.rpm @@ -0,0 +1 @@ + diff --git a/test/fixtures/slackware/home/tcl.d/tcl.tgz b/test/fixtures/slackware/home/tcl.d/tcl.tgz new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/test/fixtures/slackware/home/tcl.d/tcl.tgz @@ -0,0 +1 @@ + diff --git a/test/fixtures/slackware/var/log/packages/radeontool-1.6.1-i486-1 b/test/fixtures/slackware/var/log/packages/radeontool-1.6.1-i486-1 new file mode 100644 index 00000000..7f53326b --- /dev/null +++ b/test/fixtures/slackware/var/log/packages/radeontool-1.6.1-i486-1 @@ -0,0 +1,24 @@ +PACKAGE NAME: radeontool-1.6.1-i486-1 +COMPRESSED PACKAGE SIZE: 48K +UNCOMPRESSED PACKAGE SIZE: 150K +PACKAGE LOCATION: ./radeontool-1.6.1-i486-1.txz +PACKAGE DESCRIPTION: +radeontool: radeontool (small utility for ati radeon-based laptops) +radeontool: +radeontool: Radeontool is a small utility to control ATI Radeon-based +radeontool: laptops' backlight and external output functions +radeontool: +radeontool: Homepage: http://fdd.com/software/radeon/ +radeontool: +radeontool: +radeontool: +radeontool: +radeontool: +FILE LIST: +./ +usr/ +usr/bin/ +usr/bin/radeontool +usr/bin/avivotool +install/ +install/slack-desc diff --git a/test/fixtures/slackware/var/log/packages/rzip-2.1-i486-1 b/test/fixtures/slackware/var/log/packages/rzip-2.1-i486-1 new file mode 100644 index 00000000..0fa71f40 --- /dev/null +++ b/test/fixtures/slackware/var/log/packages/rzip-2.1-i486-1 @@ -0,0 +1,29 @@ +PACKAGE NAME: rzip-2.1-i486-1 +COMPRESSED PACKAGE SIZE: 20K +UNCOMPRESSED PACKAGE SIZE: 50K +PACKAGE LOCATION: ./rzip-2.1-i486-1.txz +PACKAGE DESCRIPTION: +rzip: rzip (a large-file compression program) +rzip: +rzip: rzip is a file compression program designed to do particularly well +rzip: on very large files containing long distance redundancy. +rzip: +rzip: rzip was written by Andrew Tridgell. +rzip: +rzip: +rzip: +rzip: +rzip: +FILE LIST: +./ +bin/ +bin/rzip +usr/ +usr/doc/ +usr/doc/rzip-2.1/ +usr/doc/rzip-2.1/COPYING +usr/man/ +usr/man/man1/ +usr/man/man1/rzip.1.gz +install/ +install/slack-desc diff --git a/test/lib/completions/explodepkg.exp b/test/lib/completions/explodepkg.exp new file mode 100644 index 00000000..e5ee35e4 --- /dev/null +++ b/test/lib/completions/explodepkg.exp @@ -0,0 +1,25 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified {/OLDPWD=/d} +} + + +setup + + +set test "should complete *.t\[gbxl\]z files and dirs" +set dir $::srcdir/fixtures/slackware/home +set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \ + \\( -type d -printf '%P/\\n' \\) -o \ + \\( -type f -name '*.t\[bglx\]z' -printf '%P\\n' \\)"] "\n"] +assert_complete_dir $files "explodepkg " $dir $test + + +sync_after_int + + +teardown diff --git a/test/lib/completions/installpkg.exp b/test/lib/completions/installpkg.exp index 6d105491..48581aa1 100644 --- a/test/lib/completions/installpkg.exp +++ b/test/lib/completions/installpkg.exp @@ -4,7 +4,7 @@ proc setup {} { proc teardown {} { - assert_env_unmodified + assert_env_unmodified {/OLDPWD=/d} } @@ -17,4 +17,33 @@ assert_complete_any "installpkg -" sync_after_int +set test "-- should complete all long options" +set options [list --warn --md5sum --root --infobox --terse --menu --ask \ + --priority --tagfile] +assert_complete $options "installpkg --" $test + + +sync_after_int + + +set test "--root should comlete only dirs" +set dirs [split [exec bash -c "find . -type d -mindepth 1 -maxdepth 1 \ + -printf '%P/\n'"] "\n"] +assert_complete $dirs "installpkg --root " $test + + +sync_after_int + + +set test "should complete *.t\[gbxl\]z files and dirs" +set dir $::srcdir/fixtures/slackware/home +set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \ + \\( -type d -printf '%P/\\n' \\) -o \ + \\( -type f -name '*.t\[bglx\]z' -printf '%P\\n' \\)"] "\n"] +assert_complete_dir $files "installpkg " $dir $test + + +sync_after_int + + teardown diff --git a/test/lib/completions/makepkg.exp b/test/lib/completions/makepkg.exp index 87845b0d..56e06339 100644 --- a/test/lib/completions/makepkg.exp +++ b/test/lib/completions/makepkg.exp @@ -17,4 +17,12 @@ assert_complete_any "makepkg -" sync_after_int +set test "-- should complete all long options" +set options [list --linkadd --prepend --chown] +assert_complete $options "makepkg --" $test + + +sync_after_int + + teardown diff --git a/test/lib/completions/removepkg.exp b/test/lib/completions/removepkg.exp index ca2aec50..b7cf4b1c 100644 --- a/test/lib/completions/removepkg.exp +++ b/test/lib/completions/removepkg.exp @@ -4,14 +4,29 @@ proc setup {} { proc teardown {} { - assert_env_unmodified + assert_env_unmodified {/ROOT=/d} } setup -assert_complete_any "removepkg -" +set test "- should complete all options" +set options [list -copy -keep -preserve -warn] +assert_complete $options "removepkg -" $test + + +sync_after_int + + +set test "should complete files in \$ROOT/var/log/packages/" +# set env(ROOT) [file normalize $::srcdir/fixtures/slackware] +# set dir $env(ROOT)/var/log/packages/ +set root [file normalize $::srcdir/fixtures/slackware] +set dir $root/var/log/packages/ +assert_bash_exec "ROOT=$root" +set files [split [exec bash -c "cd $dir && ls"] "\n"] +assert_complete $files "removepkg " $test sync_after_int diff --git a/test/lib/completions/upgradepkg.exp b/test/lib/completions/upgradepkg.exp index 86768754..860dde9e 100644 --- a/test/lib/completions/upgradepkg.exp +++ b/test/lib/completions/upgradepkg.exp @@ -4,7 +4,7 @@ proc setup {} { proc teardown {} { - assert_env_unmodified + assert_env_unmodified {/OLDPWD=/d} } @@ -17,4 +17,23 @@ assert_complete_any "upgradepkg -" sync_after_int +set test "-- should complete all long options" +set options [list --dry-run --install-new --reinstall --verbose] +assert_complete $options "upgradepkg --" $test + + +sync_after_int + + +set test "should complete *.t\[gbxl\]z files and dirs" +set dir $::srcdir/fixtures/slackware/home +set files [split [exec bash -c "cd $dir && find . -mindepth 1 -maxdepth 1 \ + \\( -type d -printf '%P/\\n' \\) -o \ + \\( -type f -name '*.t\[bglx\]z' -printf '%P\\n' \\)"] "\n"] +assert_complete_dir $files "upgradepkg " $dir $test + + +sync_after_int + + teardown