From f1f61ace512295bb8b9ce77f7b26baeb8922469c Mon Sep 17 00:00:00 2001 From: Freddy Vulto Date: Sun, 19 Jul 2009 14:48:55 +0200 Subject: [PATCH] Reviewed tests j* & k* --- test/_completion_to_review/javac.exp | 1 - test/_completion_to_review/javadoc.exp | 1 - test/_completion_to_review/killall.exp | 1 - test/_completion_to_review/kldload.exp | 1 - test/_completion_to_review/kldunload.exp | 1 - test/_completion_to_review/kplayer.exp | 1 - .../java.exp | 0 test/completion/javac.exp | 3 + test/completion/javadoc.exp | 3 + test/completion/kdvi.exp | 1 + .../kill.exp | 0 test/completion/killall.exp | 3 + test/completion/kldload.exp | 3 + test/completion/kldunload.exp | 3 + test/completion/kpdf.exp | 1 + test/completion/kplayer.exp | 3 + test/fixtures/kdvi/.DVI | 0 test/fixtures/kdvi/.DVI.Z | 0 test/fixtures/kdvi/.DVI.bz2 | 0 test/fixtures/kdvi/.DVI.gz | 0 test/fixtures/kdvi/.dvi | 0 test/fixtures/kdvi/.dvi.Z | 0 test/fixtures/kdvi/.dvi.bz2 | 0 test/fixtures/kdvi/.dvi.gz | 0 test/fixtures/kdvi/.txt | 0 test/fixtures/kpdf/.EPS | 0 test/fixtures/kpdf/.PDF | 0 test/fixtures/kpdf/.PS | 0 test/fixtures/kpdf/.eps | 0 test/fixtures/kpdf/.pdf | 0 test/fixtures/kpdf/.ps | 0 test/fixtures/kpdf/.txt | 0 test/lib/completions/evince.exp | 9 +- test/lib/completions/java.exp | 20 ++++ test/lib/completions/javac.exp | 20 ++++ test/lib/completions/javadoc.exp | 20 ++++ test/lib/completions/kdvi.exp | 27 +++++ test/lib/completions/kill.exp | 24 ++++ test/lib/completions/killall.exp | 26 +++++ test/lib/completions/kldload.exp | 20 ++++ test/lib/completions/kldunload.exp | 20 ++++ test/lib/completions/kpdf.exp | 26 +++++ test/lib/completions/kplayer.exp | 20 ++++ test/lib/completions_to_review/java.exp | 26 ----- test/lib/completions_to_review/javac.exp | 26 ----- test/lib/completions_to_review/javadoc.exp | 26 ----- test/lib/completions_to_review/kdvi.exp | 35 ------ test/lib/completions_to_review/kill.exp | 40 ------- test/lib/completions_to_review/killall.exp | 40 ------- test/lib/completions_to_review/kldload.exp | 28 ----- test/lib/completions_to_review/kldunload.exp | 28 ----- test/lib/completions_to_review/kpdf.exp | 35 ------ test/lib/completions_to_review/kplayer.exp | 26 ----- test/lib/library.exp | 104 ++++++++++++------ 54 files changed, 320 insertions(+), 352 deletions(-) delete mode 100644 test/_completion_to_review/javac.exp delete mode 100644 test/_completion_to_review/javadoc.exp delete mode 100644 test/_completion_to_review/killall.exp delete mode 100644 test/_completion_to_review/kldload.exp delete mode 100644 test/_completion_to_review/kldunload.exp delete mode 100644 test/_completion_to_review/kplayer.exp rename test/{_completion_to_review => completion}/java.exp (100%) create mode 100644 test/completion/javac.exp create mode 100644 test/completion/javadoc.exp create mode 100644 test/completion/kdvi.exp rename test/{_completion_to_review => completion}/kill.exp (100%) create mode 100644 test/completion/killall.exp create mode 100644 test/completion/kldload.exp create mode 100644 test/completion/kldunload.exp create mode 100644 test/completion/kpdf.exp create mode 100644 test/completion/kplayer.exp create mode 100644 test/fixtures/kdvi/.DVI create mode 100644 test/fixtures/kdvi/.DVI.Z create mode 100644 test/fixtures/kdvi/.DVI.bz2 create mode 100644 test/fixtures/kdvi/.DVI.gz create mode 100644 test/fixtures/kdvi/.dvi create mode 100644 test/fixtures/kdvi/.dvi.Z create mode 100644 test/fixtures/kdvi/.dvi.bz2 create mode 100644 test/fixtures/kdvi/.dvi.gz create mode 100644 test/fixtures/kdvi/.txt create mode 100644 test/fixtures/kpdf/.EPS create mode 100644 test/fixtures/kpdf/.PDF create mode 100644 test/fixtures/kpdf/.PS create mode 100644 test/fixtures/kpdf/.eps create mode 100644 test/fixtures/kpdf/.pdf create mode 100644 test/fixtures/kpdf/.ps create mode 100644 test/fixtures/kpdf/.txt create mode 100644 test/lib/completions/java.exp create mode 100644 test/lib/completions/javac.exp create mode 100644 test/lib/completions/javadoc.exp create mode 100644 test/lib/completions/kdvi.exp create mode 100644 test/lib/completions/kill.exp create mode 100644 test/lib/completions/killall.exp create mode 100644 test/lib/completions/kldload.exp create mode 100644 test/lib/completions/kldunload.exp create mode 100644 test/lib/completions/kpdf.exp create mode 100644 test/lib/completions/kplayer.exp delete mode 100644 test/lib/completions_to_review/java.exp delete mode 100644 test/lib/completions_to_review/javac.exp delete mode 100644 test/lib/completions_to_review/javadoc.exp delete mode 100644 test/lib/completions_to_review/kdvi.exp delete mode 100644 test/lib/completions_to_review/kill.exp delete mode 100644 test/lib/completions_to_review/killall.exp delete mode 100644 test/lib/completions_to_review/kldload.exp delete mode 100644 test/lib/completions_to_review/kldunload.exp delete mode 100644 test/lib/completions_to_review/kpdf.exp delete mode 100644 test/lib/completions_to_review/kplayer.exp diff --git a/test/_completion_to_review/javac.exp b/test/_completion_to_review/javac.exp deleted file mode 100644 index 21516c7b..00000000 --- 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 b89b8fc4..00000000 --- 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 bbc59539..00000000 --- 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 4b36f499..00000000 --- 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 d971f36a..00000000 --- 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 9c983665..00000000 --- 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 00000000..0b8de5f4 --- /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 00000000..995c92d7 --- /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 00000000..d68cc8bb --- /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 00000000..125ec383 --- /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 00000000..3d9daaa6 --- /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 00000000..7c22ec4a --- /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 00000000..610c2775 --- /dev/null +++ b/test/completion/kpdf.exp @@ -0,0 +1 @@ +source "lib/completions/kpdf.exp" diff --git a/test/completion/kplayer.exp b/test/completion/kplayer.exp new file mode 100644 index 00000000..1663f26c --- /dev/null +++ b/test/completion/kplayer.exp @@ -0,0 +1,3 @@ +if {[assert_bash_type {mplayer}]} { + source "lib/completions/kplayer.exp" +}; # if diff --git a/test/fixtures/kdvi/.DVI b/test/fixtures/kdvi/.DVI new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/kdvi/.DVI.Z b/test/fixtures/kdvi/.DVI.Z new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/kdvi/.DVI.bz2 b/test/fixtures/kdvi/.DVI.bz2 new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/kdvi/.DVI.gz b/test/fixtures/kdvi/.DVI.gz new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/kdvi/.dvi b/test/fixtures/kdvi/.dvi new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/kdvi/.dvi.Z b/test/fixtures/kdvi/.dvi.Z new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/kdvi/.dvi.bz2 b/test/fixtures/kdvi/.dvi.bz2 new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/kdvi/.dvi.gz b/test/fixtures/kdvi/.dvi.gz new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/kdvi/.txt b/test/fixtures/kdvi/.txt new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/kpdf/.EPS b/test/fixtures/kpdf/.EPS new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/kpdf/.PDF b/test/fixtures/kpdf/.PDF new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/kpdf/.PS b/test/fixtures/kpdf/.PS new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/kpdf/.eps b/test/fixtures/kpdf/.eps new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/kpdf/.pdf b/test/fixtures/kpdf/.pdf new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/kpdf/.ps b/test/fixtures/kpdf/.ps new file mode 100644 index 00000000..e69de29b diff --git a/test/fixtures/kpdf/.txt b/test/fixtures/kpdf/.txt new file mode 100644 index 00000000..e69de29b diff --git a/test/lib/completions/evince.exp b/test/lib/completions/evince.exp index 527a9958..22279a26 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/java.exp b/test/lib/completions/java.exp new file mode 100644 index 00000000..f14d84ad --- /dev/null +++ b/test/lib/completions/java.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "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/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..62d6b85b --- /dev/null +++ b/test/lib/completions/kill.exp @@ -0,0 +1,24 @@ +proc setup {} { +}; # setup() + + +proc teardown {} { +}; # 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..4a20aa62 --- /dev/null +++ b/test/lib/completions/kldunload.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "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_to_review/java.exp b/test/lib/completions_to_review/java.exp deleted file mode 100644 index 30b42b41..00000000 --- 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 0c0e4210..00000000 --- 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 9da75764..00000000 --- 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 73a12c59..00000000 --- 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 60da2978..00000000 --- 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 f1e20ad2..00000000 --- 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 f7839d2f..00000000 --- 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 88262bd1..00000000 --- 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 39facb7f..00000000 --- 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 48d365cb..00000000 --- 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 3d927325..968c4323 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 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 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 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 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()