[Bash-completion-commits] [SCM] bash-completion branch, master, updated. f1f61ace512295bb8b9ce77f7b26baeb8922469c

Freddy Vulto fvulto at gmail.com
Sun Jul 19 12:50:03 UTC 2009


The following commit has been merged in the master branch:
commit f1f61ace512295bb8b9ce77f7b26baeb8922469c
Author: Freddy Vulto <fvulto at gmail.com>
Date:   Sun Jul 19 14:48:55 2009 +0200

    Reviewed tests j* & k*

diff --git a/test/_completion_to_review/javac.exp b/test/_completion_to_review/javac.exp
deleted file mode 100644
index 21516c7..0000000
--- a/test/_completion_to_review/javac.exp
+++ /dev/null
@@ -1 +0,0 @@
-source "lib/completions/javac.exp"
diff --git a/test/_completion_to_review/javadoc.exp b/test/_completion_to_review/javadoc.exp
deleted file mode 100644
index b89b8fc..0000000
--- a/test/_completion_to_review/javadoc.exp
+++ /dev/null
@@ -1 +0,0 @@
-source "lib/completions/javadoc.exp"
diff --git a/test/_completion_to_review/killall.exp b/test/_completion_to_review/killall.exp
deleted file mode 100644
index bbc5953..0000000
--- a/test/_completion_to_review/killall.exp
+++ /dev/null
@@ -1 +0,0 @@
-source "lib/completions/killall.exp"
diff --git a/test/_completion_to_review/kldload.exp b/test/_completion_to_review/kldload.exp
deleted file mode 100644
index 4b36f49..0000000
--- a/test/_completion_to_review/kldload.exp
+++ /dev/null
@@ -1 +0,0 @@
-source "lib/completions/kldload.exp"
diff --git a/test/_completion_to_review/kldunload.exp b/test/_completion_to_review/kldunload.exp
deleted file mode 100644
index d971f36..0000000
--- a/test/_completion_to_review/kldunload.exp
+++ /dev/null
@@ -1 +0,0 @@
-source "lib/completions/kldunload.exp"
diff --git a/test/_completion_to_review/kplayer.exp b/test/_completion_to_review/kplayer.exp
deleted file mode 100644
index 9c98366..0000000
--- a/test/_completion_to_review/kplayer.exp
+++ /dev/null
@@ -1 +0,0 @@
-source "lib/completions/kplayer.exp"
diff --git a/test/_completion_to_review/java.exp b/test/completion/java.exp
similarity index 100%
rename from test/_completion_to_review/java.exp
rename to test/completion/java.exp
diff --git a/test/completion/javac.exp b/test/completion/javac.exp
new file mode 100644
index 0000000..0b8de5f
--- /dev/null
+++ b/test/completion/javac.exp
@@ -0,0 +1,3 @@
+if {[assert_bash_type {javac}]} {
+    source "lib/completions/javac.exp"
+}; # if
diff --git a/test/completion/javadoc.exp b/test/completion/javadoc.exp
new file mode 100644
index 0000000..995c92d
--- /dev/null
+++ b/test/completion/javadoc.exp
@@ -0,0 +1,3 @@
+if {[assert_bash_type {javadoc}]} {
+    source "lib/completions/javadoc.exp"
+}; # if
diff --git a/test/completion/kdvi.exp b/test/completion/kdvi.exp
new file mode 100644
index 0000000..d68cc8b
--- /dev/null
+++ b/test/completion/kdvi.exp
@@ -0,0 +1 @@
+source "lib/completions/kdvi.exp"
diff --git a/test/_completion_to_review/kill.exp b/test/completion/kill.exp
similarity index 100%
rename from test/_completion_to_review/kill.exp
rename to test/completion/kill.exp
diff --git a/test/completion/killall.exp b/test/completion/killall.exp
new file mode 100644
index 0000000..125ec38
--- /dev/null
+++ b/test/completion/killall.exp
@@ -0,0 +1,3 @@
+if {[assert_bash_type {killall}]} {
+    source "lib/completions/killall.exp"
+}; # if
diff --git a/test/completion/kldload.exp b/test/completion/kldload.exp
new file mode 100644
index 0000000..3d9daaa
--- /dev/null
+++ b/test/completion/kldload.exp
@@ -0,0 +1,3 @@
+if {[assert_bash_type {kldload}]} {
+    source "lib/completions/kldload.exp"
+}; # if
diff --git a/test/completion/kldunload.exp b/test/completion/kldunload.exp
new file mode 100644
index 0000000..7c22ec4
--- /dev/null
+++ b/test/completion/kldunload.exp
@@ -0,0 +1,3 @@
+if {[assert_bash_type {kldunload}]} {
+    source "lib/completions/kldunload.exp"
+}; # if
diff --git a/test/completion/kpdf.exp b/test/completion/kpdf.exp
new file mode 100644
index 0000000..610c277
--- /dev/null
+++ b/test/completion/kpdf.exp
@@ -0,0 +1 @@
+source "lib/completions/kpdf.exp"
diff --git a/test/completion/gmplayer.exp b/test/completion/kplayer.exp
similarity index 51%
copy from test/completion/gmplayer.exp
copy to test/completion/kplayer.exp
index a37fad4..1663f26 100644
--- a/test/completion/gmplayer.exp
+++ b/test/completion/kplayer.exp
@@ -1,3 +1,3 @@
 if {[assert_bash_type {mplayer}]} {
-    source "lib/completions/gmplayer.exp"
+    source "lib/completions/kplayer.exp"
 }; # if
diff --git a/test/fixtures/evince/.DVI b/test/fixtures/kdvi/.DVI
similarity index 100%
copy from test/fixtures/evince/.DVI
copy to test/fixtures/kdvi/.DVI
diff --git a/test/fixture1/bar b/test/fixtures/kdvi/.DVI.Z
similarity index 100%
copy from test/fixture1/bar
copy to test/fixtures/kdvi/.DVI.Z
diff --git a/test/fixtures/evince/.DVI.bz2 b/test/fixtures/kdvi/.DVI.bz2
similarity index 100%
copy from test/fixtures/evince/.DVI.bz2
copy to test/fixtures/kdvi/.DVI.bz2
diff --git a/test/fixtures/evince/.DVI.gz b/test/fixtures/kdvi/.DVI.gz
similarity index 100%
copy from test/fixtures/evince/.DVI.gz
copy to test/fixtures/kdvi/.DVI.gz
diff --git a/test/fixtures/evince/.dvi b/test/fixtures/kdvi/.dvi
similarity index 100%
copy from test/fixtures/evince/.dvi
copy to test/fixtures/kdvi/.dvi
diff --git a/test/fixture1/bar b/test/fixtures/kdvi/.dvi.Z
similarity index 100%
copy from test/fixture1/bar
copy to test/fixtures/kdvi/.dvi.Z
diff --git a/test/fixtures/evince/.dvi.bz2 b/test/fixtures/kdvi/.dvi.bz2
similarity index 100%
copy from test/fixtures/evince/.dvi.bz2
copy to test/fixtures/kdvi/.dvi.bz2
diff --git a/test/fixtures/evince/.dvi.gz b/test/fixtures/kdvi/.dvi.gz
similarity index 100%
copy from test/fixtures/evince/.dvi.gz
copy to test/fixtures/kdvi/.dvi.gz
diff --git a/test/fixtures/evince/.txt b/test/fixtures/kdvi/.txt
similarity index 100%
copy from test/fixtures/evince/.txt
copy to test/fixtures/kdvi/.txt
diff --git a/test/fixtures/evince/.EPS b/test/fixtures/kpdf/.EPS
similarity index 100%
copy from test/fixtures/evince/.EPS
copy to test/fixtures/kpdf/.EPS
diff --git a/test/fixtures/evince/.PDF b/test/fixtures/kpdf/.PDF
similarity index 100%
copy from test/fixtures/evince/.PDF
copy to test/fixtures/kpdf/.PDF
diff --git a/test/fixtures/evince/.PS b/test/fixtures/kpdf/.PS
similarity index 100%
copy from test/fixtures/evince/.PS
copy to test/fixtures/kpdf/.PS
diff --git a/test/fixtures/evince/.eps b/test/fixtures/kpdf/.eps
similarity index 100%
copy from test/fixtures/evince/.eps
copy to test/fixtures/kpdf/.eps
diff --git a/test/fixtures/evince/.pdf b/test/fixtures/kpdf/.pdf
similarity index 100%
copy from test/fixtures/evince/.pdf
copy to test/fixtures/kpdf/.pdf
diff --git a/test/fixtures/evince/.ps b/test/fixtures/kpdf/.ps
similarity index 100%
copy from test/fixtures/evince/.ps
copy to test/fixtures/kpdf/.ps
diff --git a/test/fixtures/evince/.txt b/test/fixtures/kpdf/.txt
similarity index 100%
copy from test/fixtures/evince/.txt
copy to test/fixtures/kpdf/.txt
diff --git a/test/lib/completions/evince.exp b/test/lib/completions/evince.exp
index 527a995..22279a2 100644
--- a/test/lib/completions/evince.exp
+++ b/test/lib/completions/evince.exp
@@ -26,11 +26,10 @@ set files {
     .tga .TGA .tif .TIF .tiff .TIFF
     .xpm .XPM .xwd .XWD
 }
-set prompt "/fixtures/evince/@"
-assert_bash_exec "cd fixtures/evince" "" $prompt
-assert_complete $files "evince " "" $prompt
-sync_after_int $prompt
-assert_bash_exec "cd \$TESTDIR"
+assert_complete_dir $files "evince " "fixtures/evince"
+
+
+sync_after_int 
 
 
 teardown
diff --git a/test/lib/completions/bc.exp b/test/lib/completions/java.exp
similarity index 83%
copy from test/lib/completions/bc.exp
copy to test/lib/completions/java.exp
index c437d03..f14d84a 100644
--- a/test/lib/completions/bc.exp
+++ b/test/lib/completions/java.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "bc --"
+assert_complete_any "java -"
 
 
 sync_after_int
diff --git a/test/lib/completions/bc.exp b/test/lib/completions/javac.exp
similarity index 83%
copy from test/lib/completions/bc.exp
copy to test/lib/completions/javac.exp
index c437d03..6013de1 100644
--- a/test/lib/completions/bc.exp
+++ b/test/lib/completions/javac.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "bc --"
+assert_complete_any "javac "
 
 
 sync_after_int
diff --git a/test/lib/completions/animate.exp b/test/lib/completions/javadoc.exp
similarity index 82%
copy from test/lib/completions/animate.exp
copy to test/lib/completions/javadoc.exp
index 26065d2..40c922c 100644
--- a/test/lib/completions/animate.exp
+++ b/test/lib/completions/javadoc.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "animate "
+assert_complete_any "javadoc "
 
 
 sync_after_int
diff --git a/test/lib/completions/kdvi.exp b/test/lib/completions/kdvi.exp
new file mode 100644
index 0000000..0196049
--- /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/cpio.exp b/test/lib/completions/kill.exp
similarity index 55%
copy from test/lib/completions/cpio.exp
copy to test/lib/completions/kill.exp
index df8f94e..62d6b85 100644
--- a/test/lib/completions/cpio.exp
+++ b/test/lib/completions/kill.exp
@@ -1,23 +1,21 @@
 proc setup {} {
-    save_env
 }; # setup()
 
 
 proc teardown {} {
-    assert_env_unmodified
 }; # teardown()
 
 
 setup
 
 
-assert_complete_any "cpio --"
+assert_complete_any "kill 1"
 
 
 sync_after_int
 
 
-assert_complete_any "cpio -R "
+assert_complete [get_signals] "kill -"
 
 
 sync_after_int
diff --git a/test/lib/completions/cpio.exp b/test/lib/completions/killall.exp
similarity index 68%
copy from test/lib/completions/cpio.exp
copy to test/lib/completions/killall.exp
index df8f94e..763c8e7 100644
--- a/test/lib/completions/cpio.exp
+++ b/test/lib/completions/killall.exp
@@ -11,13 +11,13 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "cpio --"
+assert_complete_any "killall "
 
 
 sync_after_int
 
 
-assert_complete_any "cpio -R "
+assert_complete [get_signals] "killall -"
 
 
 sync_after_int
diff --git a/test/lib/completions/animate.exp b/test/lib/completions/kldload.exp
similarity index 82%
copy from test/lib/completions/animate.exp
copy to test/lib/completions/kldload.exp
index 26065d2..0493a10 100644
--- a/test/lib/completions/animate.exp
+++ b/test/lib/completions/kldload.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "animate "
+assert_complete_any "kldload "
 
 
 sync_after_int
diff --git a/test/lib/completions/animate.exp b/test/lib/completions/kldunload.exp
similarity index 81%
copy from test/lib/completions/animate.exp
copy to test/lib/completions/kldunload.exp
index 26065d2..4a20aa6 100644
--- a/test/lib/completions/animate.exp
+++ b/test/lib/completions/kldunload.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "animate "
+assert_complete_any "kldunload "
 
 
 sync_after_int
diff --git a/test/lib/completions/kpdf.exp b/test/lib/completions/kpdf.exp
new file mode 100644
index 0000000..010abcf
--- /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/animate.exp b/test/lib/completions/kplayer.exp
similarity index 82%
copy from test/lib/completions/animate.exp
copy to test/lib/completions/kplayer.exp
index 26065d2..34c9b3b 100644
--- a/test/lib/completions/animate.exp
+++ b/test/lib/completions/kplayer.exp
@@ -11,7 +11,7 @@ proc teardown {} {
 setup
 
 
-assert_complete_any "animate "
+assert_complete_any "kplayer "
 
 
 sync_after_int
diff --git a/test/lib/completions_to_review/java.exp b/test/lib/completions_to_review/java.exp
deleted file mode 100644
index 30b42b4..0000000
--- a/test/lib/completions_to_review/java.exp
+++ /dev/null
@@ -1,26 +0,0 @@
-proc setup {} {
-}; # setup()
-
-
-proc teardown {} {
-}; # teardown()
-
-
-setup
-
-
-set test "Tab should complete"
-    # Try completion
-set cmd "java -"
-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_to_review/javac.exp b/test/lib/completions_to_review/javac.exp
deleted file mode 100644
index 0c0e421..0000000
--- a/test/lib/completions_to_review/javac.exp
+++ /dev/null
@@ -1,26 +0,0 @@
-proc setup {} {
-}; # setup()
-
-
-proc teardown {} {
-}; # teardown()
-
-
-setup
-
-
-set test "Tab should complete"
-    # Try completion
-set cmd "javac "
-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_to_review/javadoc.exp b/test/lib/completions_to_review/javadoc.exp
deleted file mode 100644
index 9da7576..0000000
--- a/test/lib/completions_to_review/javadoc.exp
+++ /dev/null
@@ -1,26 +0,0 @@
-proc setup {} {
-}; # setup()
-
-
-proc teardown {} {
-}; # teardown()
-
-
-setup
-
-
-set test "Tab should complete"
-    # Try completion
-set cmd "javadoc "
-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_to_review/kdvi.exp b/test/lib/completions_to_review/kdvi.exp
deleted file mode 100644
index 73a12c5..0000000
--- a/test/lib/completions_to_review/kdvi.exp
+++ /dev/null
@@ -1,35 +0,0 @@
-proc setup {} {
-    set test setup
-    set cmd "touch fixture1/t.{dvi{,.gz,.bz2},DVI{,.gz,.bz2}}";  # Create temporary files
-    send "$cmd\r"
-    expect -ex "$cmd\r\n/@"
-}; # setup()
-
-
-proc teardown {} {
-    set test teardown
-    set cmd "rm fixture1/t.{dvi{,.gz,.bz2},DVI{,.gz,.bz2}}";  # Remove temporary files
-    send "$cmd\r"
-    expect -ex "$cmd\r\n/@"
-}; # teardown()
-
-
-setup
-
-
-set test "Tab should complete kdvi"
-    # Try completion
-set cmd "kdvi fixture1/"
-send "$cmd\t"
-expect {
-    -re "^${cmd}\r\n(\.svn/ +|)bar bar.d/ +foo.d/ +(\.svn/ +|)t.dvi +t.DVI +t.dvi.bz2 +t.DVI.bz2 +t.dvi.gz +t.DVI.gz *\r\n/@$cmd$"  { pass "$test" }
-    -re /@ { unresolved "$test at prompt" }
-    default { unresolved "$test" }
-}; # expect
-
-
-#sleep .5
-sync_after_int
-
-
-teardown
diff --git a/test/lib/completions_to_review/kill.exp b/test/lib/completions_to_review/kill.exp
deleted file mode 100644
index 60da297..0000000
--- a/test/lib/completions_to_review/kill.exp
+++ /dev/null
@@ -1,40 +0,0 @@
-proc setup {} {
-}; # setup()
-
-
-proc teardown {} {
-}; # teardown()
-
-
-setup
-
-
-set test "Tab should show completions"
-    # Try completion
-set cmd "kill 1"
-send "$cmd\t"
-expect {
-    -re "$cmd\r\n.*$cmd$" { pass "$test" }
-    -re /@ { unresolved "$test at prompt" }
-    -re eof { unresolved "eof" }
-}; # expect
-
-
-sync_after_int
-
-
-set test "Tab should show signals"
-    # Try completion
-set cmd "kill -"
-send "$cmd\t"
-expect {
-    -re "$cmd\r\n.*-KILL.*$cmd$" { pass "$test" }
-    -re /@ { unresolved "$test at prompt" }
-    -re eof { unresolved "eof" }
-}; # expect
-
-
-sync_after_int
-
-
-teardown
diff --git a/test/lib/completions_to_review/killall.exp b/test/lib/completions_to_review/killall.exp
deleted file mode 100644
index f1e20ad..0000000
--- a/test/lib/completions_to_review/killall.exp
+++ /dev/null
@@ -1,40 +0,0 @@
-proc setup {} {
-}; # setup()
-
-
-proc teardown {} {
-}; # teardown()
-
-
-setup
-
-
-set test "Tab should show completions"
-    # Try completion
-set cmd "killall "
-send "$cmd\t"
-expect {
-    -re "$cmd\r\n.*/@$cmd$" { pass "$test" }
-    -re /@ { unresolved "$test at prompt" }
-    -re eof { unresolved "eof" }
-}; # expect
-
-
-sync_after_int
-
-
-set test "Tab should complete signals"
-    # Try completion
-set cmd "killall -"
-send "$cmd\t"
-expect {
-    -re "$cmd\r\n.*-KILL.*/@$cmd$" { pass "$test" }
-    -re /@ { unresolved "$test at prompt" }
-    -re eof { unresolved "eof" }
-}; # expect
-
-
-sync_after_int
-
-
-teardown
diff --git a/test/lib/completions_to_review/kldload.exp b/test/lib/completions_to_review/kldload.exp
deleted file mode 100644
index f7839d2..0000000
--- a/test/lib/completions_to_review/kldload.exp
+++ /dev/null
@@ -1,28 +0,0 @@
-proc setup {} {
-}; # setup()
-
-
-proc teardown {} {
-}; # teardown()
-
-
-setup
-
-
-set test "Tab should complete"
-    # Try completion
-set cmd "kldload "
-send "$cmd\t"
-sync_after_tab
-expect {
-    -re "^$cmd.*$" { pass "$test" }
-    -re /@ { unresolved "$test at prompt" }
-    -re eof { unresolved "eof" }
-}; # expect
-
-
-sleep .4
-sync_after_int
-
-
-teardown
diff --git a/test/lib/completions_to_review/kldunload.exp b/test/lib/completions_to_review/kldunload.exp
deleted file mode 100644
index 88262bd..0000000
--- a/test/lib/completions_to_review/kldunload.exp
+++ /dev/null
@@ -1,28 +0,0 @@
-proc setup {} {
-}; # setup()
-
-
-proc teardown {} {
-}; # teardown()
-
-
-setup
-
-
-set test "Tab should complete"
-    # Try completion
-set cmd "kldunload "
-send "$cmd\t"
-sync_after_tab
-expect {
-    -re "^$cmd.*$" { pass "$test" }
-    -re /@ { unresolved "$test at prompt" }
-    -re eof { unresolved "eof" }
-}; # expect
-
-
-sleep .4
-sync_after_int
-
-
-teardown
diff --git a/test/lib/completions_to_review/kpdf.exp b/test/lib/completions_to_review/kpdf.exp
deleted file mode 100644
index 39facb7..0000000
--- a/test/lib/completions_to_review/kpdf.exp
+++ /dev/null
@@ -1,35 +0,0 @@
-proc setup {} {
-    set test setup
-    set cmd "touch fixture1/t.{pdf,PDF,{,e}ps,{,E}PS}";  # Create temporary files
-    send "$cmd\r"
-    expect -ex "$cmd\r\n/@"
-}; # setup()
-
-
-proc teardown {} {
-    set test teardown
-    set cmd "rm fixture1/t.{pdf,PDF,{,e}ps,{,E}PS}";  # Remove temporary files
-    send "$cmd\r"
-    expect -ex "$cmd\r\n/@"
-}; # teardown()
-
-
-setup
-
-
-set test "Tab should complete kpdf"
-    # Try completion
-set cmd "kpdf fixture1/"
-send "$cmd\t"
-expect {
-    -re "^${cmd}\r\n(\.svn/ +|)bar bar.d/ +foo.d/ +(\.svn/ +|)t.eps +t.EPS +t.pdf +t.PDF +t.ps +t.PS *\r\n/@$cmd$"  { pass "$test" }
-    -re /@ { unresolved "$test at prompt" }
-    default { unresolved "$test" }
-}; # expect
-
-
-sleep .5
-sync_after_int
-
-
-teardown
diff --git a/test/lib/completions_to_review/kplayer.exp b/test/lib/completions_to_review/kplayer.exp
deleted file mode 100644
index 48d365c..0000000
--- a/test/lib/completions_to_review/kplayer.exp
+++ /dev/null
@@ -1,26 +0,0 @@
-proc setup {} {
-}; # setup()
-
-
-proc teardown {} {
-}; # teardown()
-
-
-setup
-
-
-set test "Tab should complete"
-    # Try completion
-set cmd "kplayer "
-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/library.exp b/test/lib/library.exp
index 3d92732..968c432 100644
--- a/test/lib/library.exp
+++ b/test/lib/library.exp
@@ -54,7 +54,6 @@ proc assert_bash_type {command} {
 
 # Make sure the expected items are returned by TAB-completing the specified
 # command.
-# Break items into chunks because `expect' seems to have a limited buffer size
 # @param list $expected
 # @param string $cmd  Command given to generate items
 # @param string $test  (optional) Test titel.  Default is "$cmd<TAB> should show completions"
@@ -98,34 +97,6 @@ proc assert_complete {expected cmd {test ""} {prompt /@} {size 20}} {
 }; # assert_complete()
 
 
-# Make sure a partial argument is completed.
-# A completion is tried with `$partial', or if this is empty, the first
-# character of the first item of `$expected'.  Only the items from $expected,
-# starting with this character are then expected as completions.
-# @param list $expected  List of all completions.
-# @param string $cmd  Command given to generate items
-# @param string $test  (optional) Test titel.  Default is "$cmd<TAB> should show completions"
-# @param string $prompt  (optional) Bash prompt.  Default is "/@"
-# @param integer $size  (optional) Chunk size.  Default is 20.
-# @result boolean  True if successful, False if not
-proc assert_complete_partial {expected cmd {partial ""} {test ""} {prompt /@} {size 20}} {
-    if {$test == ""} {set test "$cmd should complete partial argument"}
-    if {[llength $expected] == 0} {
-        unresolved "$test"
-    } else {
-        set pick {}
-        foreach item $expected {
-            if {$partial == ""} {set partial [string range $item 0 0]}
-                # Only append item if starting with $partial
-            if {[string range $item 0 [expr [string length $partial] - 1]] == "$partial"} {
-                lappend pick $item
-            }; # if
-        }; # foreach
-        assert_complete $pick "$cmd $partial" $test $prompt $size
-    }; # if
-}; # assert_complete_partial()
-
-
 # Make sure any completions are returned
 proc assert_complete_any {cmd {test ""} {prompt /@}} {
     if {$test == ""} {set test "$cmd should show completions"}
@@ -155,6 +126,53 @@ proc assert_complete_any {cmd {test ""} {prompt /@}} {
 }; # assert_complete_any()
 
 
+# Make sure the expected files are returned by TAB-completing the
+# specified command in the specified subdirectory.
+# @param list $expected
+# @param string $cmd  Command given to generate items
+# @param string $dir  Subdirectory to attempt completion in.  The directory must be relative from the $TESTDIR and without a trailing slash.  E.g. `fixtures/evince'
+# @param string $test  (optional) Test titel.  Default is "$cmd<TAB> should show completions"
+# @param string $prompt  (optional) Bash prompt.  Default is "/@"
+# @param integer $size  (optional) Chunk size.  Default is 20.
+# @result boolean  True if successful, False if not
+proc assert_complete_dir {expected cmd dir {test ""} {size 20}} {
+    set prompt "/$dir/@"
+    assert_bash_exec "cd $dir" "" $prompt
+    assert_complete $expected $cmd $test $prompt $size
+    sync_after_int $prompt
+    assert_bash_exec "cd \$TESTDIR"
+}; # assert_complete_dir
+    
+
+
+# Make sure a partial argument is completed.
+# A completion is tried with `$partial', or if this is empty, the first
+# character of the first item of `$expected'.  Only the items from $expected,
+# starting with this character are then expected as completions.
+# @param list $expected  List of all completions.
+# @param string $cmd  Command given to generate items
+# @param string $test  (optional) Test titel.  Default is "$cmd<TAB> should show completions"
+# @param string $prompt  (optional) Bash prompt.  Default is "/@"
+# @param integer $size  (optional) Chunk size.  Default is 20.
+# @result boolean  True if successful, False if not
+proc assert_complete_partial {expected cmd {partial ""} {test ""} {prompt /@} {size 20}} {
+    if {$test == ""} {set test "$cmd should complete partial argument"}
+    if {[llength $expected] == 0} {
+        unresolved "$test"
+    } else {
+        set pick {}
+        foreach item $expected {
+            if {$partial == ""} {set partial [string range $item 0 0]}
+                # Only append item if starting with $partial
+            if {[string range $item 0 [expr [string length $partial] - 1]] == "$partial"} {
+                lappend pick $item
+            }; # if
+        }; # foreach
+        assert_complete $pick "$cmd $partial" $test $prompt $size
+    }; # if
+}; # assert_complete_partial()
+
+
 # Make sure the bash environment hasn't changed between now and the last call
 # to `save_env()'.
 # @param string $sed  Sed commands to preprocess diff output.
@@ -248,7 +266,7 @@ proc assert_exec {cmd {stdout ''} {test ''}} {
 }; # assert_exec()
 
 
-# Get known hostnames
+# Get hostnames
 # @return list  Hostnames
 proc get_hosts {} {
     set hosts [exec bash -c "compgen -A hostname"]
@@ -266,6 +284,25 @@ proc get_hosts {} {
 }; # get_hosts()
 
 
+# Get signals
+# This function is written in analogy to the bash function `_signals()' in
+# `bash_completion'.
+# @return list  Signals starting with `SIG', but with the `SIG' prefix removed.
+proc get_signals {} {
+    set signals {}
+    foreach signal [exec bash -c {compgen -A signal}] {
+            # Does signal start with `SIG'?
+        if {[string range $signal 0 [expr [string length "SIG"] - 1]] == "SIG"} {
+                # Remove `SIG' prefix
+            set signal [string range $signal 3 end]
+                # Add signal (with dash (-) prefix) to list
+            lappend signals -$signal
+        }; # if
+    }; # foreach
+    return $signals
+}; # get_signals()
+
+
 # Expect items.
 # Break items into chunks because `expect' seems to have a limited buffer size
 # @param list $items
@@ -368,7 +405,12 @@ proc sync_after_int {{prompt /@}} {
     set test "Sync after INT"
     sleep .1
     send \031\003;  # QUIT/INT
-    expect $prompt
+        # NOTE: Regexp `.*' causes `expect' to discard previous unknown output.
+        #       This is necessary if a completion doesn't match expectations.
+        #       For instance with `filetype_xpec' completion (e.g. `kdvi') if
+        #       one expects `.txt' as a completion (wrong, because it isn't
+        #       there), the unmatched completions need to be cleaned up.
+    expect -re ".*$prompt$"
 }; # sync_after_int()
 
 

-- 
bash-completion



More information about the Bash-completion-commits mailing list