[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-349-ga0834d3

Igor Murzov e-mail at date.by
Sun Jun 5 21:13:47 UTC 2011


The following commit has been merged in the master branch:
commit dbd8670cf4acf1f500f615a5a97529da0d741000
Author: Igor Murzov <e-mail at date.by>
Date:   Sat Jun 4 18:55:05 2011 +0400

    testsuite: Improve pkgtool tests

diff --git a/test/completion/explodepkg.exp b/test/completion/explodepkg.exp
new file mode 100644
index 0000000..7d6ce79
--- /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 0000000..8b13789
--- /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 0000000..8b13789
--- /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 0000000..8b13789
--- /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 0000000..7f53326
--- /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 0000000..0fa71f4
--- /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 0000000..e5ee35e
--- /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 6d10549..48581aa 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 "--<TAB> 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 87845b0..56e0633 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 "--<TAB> 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 ca2aec5..b7cf4b1 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 "-<TAB> 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 8676875..860dde9 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 "--<TAB> 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

-- 
bash-completion



More information about the Bash-completion-commits mailing list