diff options
author | Freddy Vulto <freddy@rebase.(none)> | 2009-07-17 16:15:02 +0200 |
---|---|---|
committer | Freddy Vulto <freddy@rebase.(none)> | 2009-07-17 16:15:02 +0200 |
commit | 55bc44b03514c6450ee8eea2de6369249e6846e0 (patch) | |
tree | 351d6277e390ef497673a1ba51045c90f6e5c440 /test | |
parent | f615d17cb6c354c7dbb5678618fc1a22e3cab24f (diff) | |
download | bash-completion-55bc44b03514c6450ee8eea2de6369249e6846e0.tar.gz |
Reviewed tests e*
Fixed `assert_complete()' to remove an optional (partial) argument from
`cmd' when expecting `cmd + longestCommonPrefix'.
Added `prompt' argument to procs `assert_bash_exec()' &
`sync_after_int()'
Diffstat (limited to 'test')
101 files changed, 133 insertions, 144 deletions
diff --git a/test/_completion_to_review/enscript.exp b/test/_completion_to_review/enscript.exp deleted file mode 100644 index b10236b0..00000000 --- a/test/_completion_to_review/enscript.exp +++ /dev/null @@ -1 +0,0 @@ -source "lib/completions/enscript.exp" diff --git a/test/_completion_to_review/env.exp b/test/_completion_to_review/env.exp deleted file mode 100644 index cc47ea19..00000000 --- a/test/_completion_to_review/env.exp +++ /dev/null @@ -1 +0,0 @@ -source "lib/completions/env.exp" diff --git a/test/_completion_to_review/evince.exp b/test/_completion_to_review/evince.exp deleted file mode 100644 index 3df860ee..00000000 --- a/test/_completion_to_review/evince.exp +++ /dev/null @@ -1,12 +0,0 @@ -set test "Completion via _filedir_xspec() should be installed" -set cmd "complete -p evince" -send "$cmd\r" - -set expected "^$cmd\r\ncomplete -o filenames -F _filedir_xspec evince\r\n/@$" -expect { - -re $expected { pass "$test" } - -re /@ { fail "$test at prompt" } -}; # expect - - -source "lib/completions/evince.exp" diff --git a/test/_completion_to_review/expand.exp b/test/_completion_to_review/expand.exp deleted file mode 100644 index 55eec5ab..00000000 --- a/test/_completion_to_review/expand.exp +++ /dev/null @@ -1 +0,0 @@ -source "lib/completions/expand.exp" diff --git a/test/completion/enscript.exp b/test/completion/enscript.exp new file mode 100644 index 00000000..ec6d75cb --- /dev/null +++ b/test/completion/enscript.exp @@ -0,0 +1,3 @@ +if {[assert_bash_type {enscript}]} { + source "lib/completions/enscript.exp" +}; # if diff --git a/test/completion/env.exp b/test/completion/env.exp new file mode 100644 index 00000000..a96c0535 --- /dev/null +++ b/test/completion/env.exp @@ -0,0 +1,3 @@ +if {[assert_bash_type {env}]} { + source "lib/completions/env.exp" +}; # if diff --git a/test/completion/evince.exp b/test/completion/evince.exp new file mode 100644 index 00000000..24815d58 --- /dev/null +++ b/test/completion/evince.exp @@ -0,0 +1 @@ +source "lib/completions/evince.exp" diff --git a/test/completion/expand.exp b/test/completion/expand.exp new file mode 100644 index 00000000..783069d7 --- /dev/null +++ b/test/completion/expand.exp @@ -0,0 +1,3 @@ +if {[assert_bash_type {expand}]} { + source "lib/completions/expand.exp" +}; # if diff --git a/test/fixtures/evince/.BMP b/test/fixtures/evince/.BMP new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.BMP diff --git a/test/fixtures/evince/.CBR b/test/fixtures/evince/.CBR new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.CBR diff --git a/test/fixtures/evince/.CBZ b/test/fixtures/evince/.CBZ new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.CBZ diff --git a/test/fixtures/evince/.DJV b/test/fixtures/evince/.DJV new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.DJV diff --git a/test/fixtures/evince/.DJVU b/test/fixtures/evince/.DJVU new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.DJVU diff --git a/test/fixtures/evince/.DVI b/test/fixtures/evince/.DVI new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.DVI diff --git a/test/fixtures/evince/.DVI.BZ2 b/test/fixtures/evince/.DVI.BZ2 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.DVI.BZ2 diff --git a/test/fixtures/evince/.DVI.GZ b/test/fixtures/evince/.DVI.GZ new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.DVI.GZ diff --git a/test/fixtures/evince/.DVI.bz2 b/test/fixtures/evince/.DVI.bz2 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.DVI.bz2 diff --git a/test/fixtures/evince/.DVI.gz b/test/fixtures/evince/.DVI.gz new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.DVI.gz diff --git a/test/fixtures/evince/.EPS b/test/fixtures/evince/.EPS new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.EPS diff --git a/test/fixtures/evince/.EPS.BZ2 b/test/fixtures/evince/.EPS.BZ2 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.EPS.BZ2 diff --git a/test/fixtures/evince/.EPS.GZ b/test/fixtures/evince/.EPS.GZ new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.EPS.GZ diff --git a/test/fixtures/evince/.EPS.bz2 b/test/fixtures/evince/.EPS.bz2 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.EPS.bz2 diff --git a/test/fixtures/evince/.EPS.gz b/test/fixtures/evince/.EPS.gz new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.EPS.gz diff --git a/test/fixtures/evince/.GIF b/test/fixtures/evince/.GIF new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.GIF diff --git a/test/fixtures/evince/.ICO b/test/fixtures/evince/.ICO new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.ICO diff --git a/test/fixtures/evince/.JPEG b/test/fixtures/evince/.JPEG new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.JPEG diff --git a/test/fixtures/evince/.JPG b/test/fixtures/evince/.JPG new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.JPG diff --git a/test/fixtures/evince/.MIFF b/test/fixtures/evince/.MIFF new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.MIFF diff --git a/test/fixtures/evince/.PBM b/test/fixtures/evince/.PBM new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.PBM diff --git a/test/fixtures/evince/.PCX b/test/fixtures/evince/.PCX new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.PCX diff --git a/test/fixtures/evince/.PDF b/test/fixtures/evince/.PDF new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.PDF diff --git a/test/fixtures/evince/.PDF.BZ2 b/test/fixtures/evince/.PDF.BZ2 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.PDF.BZ2 diff --git a/test/fixtures/evince/.PDF.GZ b/test/fixtures/evince/.PDF.GZ new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.PDF.GZ diff --git a/test/fixtures/evince/.PDF.bz2 b/test/fixtures/evince/.PDF.bz2 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.PDF.bz2 diff --git a/test/fixtures/evince/.PDF.gz b/test/fixtures/evince/.PDF.gz new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.PDF.gz diff --git a/test/fixtures/evince/.PGM b/test/fixtures/evince/.PGM new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.PGM diff --git a/test/fixtures/evince/.PNG b/test/fixtures/evince/.PNG new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.PNG diff --git a/test/fixtures/evince/.PNM b/test/fixtures/evince/.PNM new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.PNM diff --git a/test/fixtures/evince/.PPM b/test/fixtures/evince/.PPM new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.PPM diff --git a/test/fixtures/evince/.PS b/test/fixtures/evince/.PS new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.PS diff --git a/test/fixtures/evince/.PS.BZ2 b/test/fixtures/evince/.PS.BZ2 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.PS.BZ2 diff --git a/test/fixtures/evince/.PS.GZ b/test/fixtures/evince/.PS.GZ new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.PS.GZ diff --git a/test/fixtures/evince/.PS.bz2 b/test/fixtures/evince/.PS.bz2 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.PS.bz2 diff --git a/test/fixtures/evince/.PS.gz b/test/fixtures/evince/.PS.gz new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.PS.gz diff --git a/test/fixtures/evince/.TGA b/test/fixtures/evince/.TGA new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.TGA diff --git a/test/fixtures/evince/.TIF b/test/fixtures/evince/.TIF new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.TIF diff --git a/test/fixtures/evince/.TIFF b/test/fixtures/evince/.TIFF new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.TIFF diff --git a/test/fixtures/evince/.XPM b/test/fixtures/evince/.XPM new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.XPM diff --git a/test/fixtures/evince/.XWD b/test/fixtures/evince/.XWD new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.XWD diff --git a/test/fixtures/evince/.bmp b/test/fixtures/evince/.bmp new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.bmp diff --git a/test/fixtures/evince/.cbr b/test/fixtures/evince/.cbr new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.cbr diff --git a/test/fixtures/evince/.cbz b/test/fixtures/evince/.cbz new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.cbz diff --git a/test/fixtures/evince/.djv b/test/fixtures/evince/.djv new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.djv diff --git a/test/fixtures/evince/.djvu b/test/fixtures/evince/.djvu new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.djvu diff --git a/test/fixtures/evince/.dvi b/test/fixtures/evince/.dvi new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.dvi diff --git a/test/fixtures/evince/.dvi.BZ2 b/test/fixtures/evince/.dvi.BZ2 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.dvi.BZ2 diff --git a/test/fixtures/evince/.dvi.GZ b/test/fixtures/evince/.dvi.GZ new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.dvi.GZ diff --git a/test/fixtures/evince/.dvi.bz2 b/test/fixtures/evince/.dvi.bz2 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.dvi.bz2 diff --git a/test/fixtures/evince/.dvi.gz b/test/fixtures/evince/.dvi.gz new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.dvi.gz diff --git a/test/fixtures/evince/.eps b/test/fixtures/evince/.eps new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.eps diff --git a/test/fixtures/evince/.eps.BZ2 b/test/fixtures/evince/.eps.BZ2 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.eps.BZ2 diff --git a/test/fixtures/evince/.eps.GZ b/test/fixtures/evince/.eps.GZ new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.eps.GZ diff --git a/test/fixtures/evince/.eps.bz2 b/test/fixtures/evince/.eps.bz2 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.eps.bz2 diff --git a/test/fixtures/evince/.eps.gz b/test/fixtures/evince/.eps.gz new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.eps.gz diff --git a/test/fixtures/evince/.gif b/test/fixtures/evince/.gif new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.gif diff --git a/test/fixtures/evince/.ico b/test/fixtures/evince/.ico new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.ico diff --git a/test/fixtures/evince/.jpeg b/test/fixtures/evince/.jpeg new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.jpeg diff --git a/test/fixtures/evince/.jpg b/test/fixtures/evince/.jpg new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.jpg diff --git a/test/fixtures/evince/.miff b/test/fixtures/evince/.miff new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.miff diff --git a/test/fixtures/evince/.pbm b/test/fixtures/evince/.pbm new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.pbm diff --git a/test/fixtures/evince/.pcx b/test/fixtures/evince/.pcx new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.pcx diff --git a/test/fixtures/evince/.pdf b/test/fixtures/evince/.pdf new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.pdf diff --git a/test/fixtures/evince/.pdf.BZ2 b/test/fixtures/evince/.pdf.BZ2 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.pdf.BZ2 diff --git a/test/fixtures/evince/.pdf.GZ b/test/fixtures/evince/.pdf.GZ new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.pdf.GZ diff --git a/test/fixtures/evince/.pdf.bz2 b/test/fixtures/evince/.pdf.bz2 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.pdf.bz2 diff --git a/test/fixtures/evince/.pdf.gz b/test/fixtures/evince/.pdf.gz new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.pdf.gz diff --git a/test/fixtures/evince/.pgm b/test/fixtures/evince/.pgm new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.pgm diff --git a/test/fixtures/evince/.png b/test/fixtures/evince/.png new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.png diff --git a/test/fixtures/evince/.pnm b/test/fixtures/evince/.pnm new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.pnm diff --git a/test/fixtures/evince/.ppm b/test/fixtures/evince/.ppm new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.ppm diff --git a/test/fixtures/evince/.ps b/test/fixtures/evince/.ps new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.ps diff --git a/test/fixtures/evince/.ps.BZ2 b/test/fixtures/evince/.ps.BZ2 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.ps.BZ2 diff --git a/test/fixtures/evince/.ps.GZ b/test/fixtures/evince/.ps.GZ new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.ps.GZ diff --git a/test/fixtures/evince/.ps.bz2 b/test/fixtures/evince/.ps.bz2 new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.ps.bz2 diff --git a/test/fixtures/evince/.ps.gz b/test/fixtures/evince/.ps.gz new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.ps.gz diff --git a/test/fixtures/evince/.tga b/test/fixtures/evince/.tga new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.tga diff --git a/test/fixtures/evince/.tif b/test/fixtures/evince/.tif new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.tif diff --git a/test/fixtures/evince/.tiff b/test/fixtures/evince/.tiff new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.tiff diff --git a/test/fixtures/evince/.txt b/test/fixtures/evince/.txt new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.txt diff --git a/test/fixtures/evince/.xpm b/test/fixtures/evince/.xpm new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.xpm diff --git a/test/fixtures/evince/.xwd b/test/fixtures/evince/.xwd new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/fixtures/evince/.xwd diff --git a/test/lib/completions/enscript.exp b/test/lib/completions/enscript.exp new file mode 100644 index 00000000..7fefabdd --- /dev/null +++ b/test/lib/completions/enscript.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "enscript --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/env.exp b/test/lib/completions/env.exp new file mode 100644 index 00000000..0f523cbc --- /dev/null +++ b/test/lib/completions/env.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "env --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/evince.exp b/test/lib/completions/evince.exp new file mode 100644 index 00000000..67dc8079 --- /dev/null +++ b/test/lib/completions/evince.exp @@ -0,0 +1,33 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified {/OLDPWD=/d} +}; # teardown() + + +setup + + +set files { + foo/ + .bmp .BMP .cbr .CBR .cbz .CBZ .djv .DJV .djvu .DJVU + .dvi .DVI .dvi.bz2 .dvi.BZ2 .DVI.bz2 .DVI.BZ2 .dvi.gz .dvi.GZ .DVI.gz .DVI.GZ + .eps .EPS .eps.bz2 .eps.BZ2 .EPS.bz2 .EPS.BZ2 .eps.gz .eps.GZ .EPS.gz .EPS.GZ + .gif .GIF .ico .ICO .jpeg .JPEG .jpg .JPG .miff .MIFF .pbm .PBM .pcx .PCX + .pdf .PDF .pdf.bz2 .pdf.BZ2 .PDF.bz2 .PDF.BZ2 .pdf.gz .pdf.GZ .PDF.gz .PDF.GZ + .pgm .PGM .png .PNG .pnm .PNM .ppm .PPM + .ps .PS .ps.bz2 .ps.BZ2 .PS.bz2 .PS.BZ2 .ps.gz .ps.GZ .PS.gz .PS.GZ + .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 ../.." + + +teardown diff --git a/test/lib/completions/expand.exp b/test/lib/completions/expand.exp new file mode 100644 index 00000000..de1b7f6d --- /dev/null +++ b/test/lib/completions/expand.exp @@ -0,0 +1,20 @@ +proc setup {} { + save_env +}; # setup() + + +proc teardown {} { + assert_env_unmodified +}; # teardown() + + +setup + + +assert_complete_any "expand --" + + +sync_after_int + + +teardown diff --git a/test/lib/completions/finger.exp b/test/lib/completions/finger.exp index 935c9b27..136f1c6e 100644 --- a/test/lib/completions/finger.exp +++ b/test/lib/completions/finger.exp @@ -33,11 +33,11 @@ sync_after_int set test "Tab should complete hostnames" # Build string list of hostnames set hosts {} -foreach h [exec bash -c "compgen -A hostname"] { +foreach h [get_hosts] { # Prefix hosts with username 'test@' lappend hosts "test@$h" }; # foreach -assert_complete $hosts "finger test@" $test +assert_complete_partial $hosts finger test@ $test sync_after_int @@ -48,7 +48,7 @@ set test "Tab should complete partial hostname" # host. set hosts {} set char "" -foreach h [exec bash -c "compgen -A hostname"] { +foreach h [get_hosts] { if {$char == ""} {set char [string range $h 0 0]} # Only append hostname if starting with $char if {[string range $h 0 0] == "$char"} { diff --git a/test/lib/completions_to_review/enscript.exp b/test/lib/completions_to_review/enscript.exp deleted file mode 100644 index e261618c..00000000 --- a/test/lib/completions_to_review/enscript.exp +++ /dev/null @@ -1,26 +0,0 @@ -proc setup {} { -}; # setup() - - -proc teardown {} { -}; # teardown() - - -setup - - -set test "Tab should complete" - # Try completion -set cmd "enscript " -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/env.exp b/test/lib/completions_to_review/env.exp deleted file mode 100644 index 35d6fefb..00000000 --- a/test/lib/completions_to_review/env.exp +++ /dev/null @@ -1,31 +0,0 @@ -proc setup {} { -}; # setup() - - -proc teardown {} { -}; # teardown() - - -setup - - -set test "Tab should complete" - # Try completion -set cmd "env " -send "$cmd\t" -expect { - -re "^$cmd\r\n.*$cmd$" { pass "$test" } - -re /@ { unresolved "$test at prompt" } - -re eof { unresolved "eof" } -}; # expect - - -# Interrupt command - -set test "Sync after INT" -sleep 0.01 -send \031\003; # QUIT/INT -expect -ex /@ - - -teardown diff --git a/test/lib/completions_to_review/evince.exp b/test/lib/completions_to_review/evince.exp deleted file mode 100644 index 1d62aea4..00000000 --- a/test/lib/completions_to_review/evince.exp +++ /dev/null @@ -1,32 +0,0 @@ -proc setup {} { - set cmd "touch fixture1/t.{CB{R,Z},DJV{,U},cb{r,z},djv{,u}}"; # Create temporary files - send "$cmd\r" - expect -ex "$cmd\r\n/@" -}; # setup() - - -proc teardown {} { - set cmd "rm fixture1/t.{CB{R,Z},DJV{,U},cb{r,z},djv{,u}}"; # Remove temporary files - send "$cmd\r" - expect -ex "$cmd\r\n/@" -}; # teardown() - - -setup - - -set test "Tab should complete evince" - # Try completion -set cmd "evince fixture1/" -send "$cmd\t" -expect { - -re "^${cmd}\r\n(\.svn/ +|)bar bar.d/ +foo.d/ +(\.svn/ +|)t.cbr +t.CBR +t.cbz +t.CBZ +t.djv +t.DJV +t.djvu +t.DJVU *\r\n/@$cmd$" { pass "$test" } - -re /@ { unresolved "$test at prompt" } - default { unresolved "$test" } -}; # expect - - -sync_after_int - - -teardown diff --git a/test/lib/completions_to_review/expand.exp b/test/lib/completions_to_review/expand.exp deleted file mode 100644 index 7c2ecb0f..00000000 --- a/test/lib/completions_to_review/expand.exp +++ /dev/null @@ -1,26 +0,0 @@ -proc setup {} { -}; # setup() - - -proc teardown {} { -}; # teardown() - - -setup - - -set test "Tab should complete" - # Try completion -set cmd "expand " -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 f6f56361..8f6c18bf 100644 --- a/test/lib/library.exp +++ b/test/lib/library.exp @@ -12,19 +12,20 @@ package require textutil::string # exit status of the previously executed bash command will be # checked; specify `title' to adorn the error message. # @param string $title (optional) Command title. If empty, `cmd' is used. -proc assert_bash_exec {{aCmd ""} {title ""}} { +# @param string $prompt (optional) Bash prompt. Default is "/@" +proc assert_bash_exec {{aCmd ""} {title ""} {prompt /@}} { if {[string length $aCmd] != 0} { send "$aCmd\r" expect -ex "$aCmd\r\n" }; # if if {[string length $title] == 0} {set title $aCmd} - expect -ex "/@" + expect -ex $prompt set out $expect_out(buffer); # Catch (non-expected) output set cmd "echo $?" send "$cmd\r" expect { - -ex "$cmd\r\n0\r\n/@" {} - /@ { + -ex "$cmd\r\n0\r\n$prompt" {} + $prompt { if {[info exists multipass_name]} { fail "ERROR executing bash command \"$title\"" }; # if @@ -51,12 +52,13 @@ proc assert_bash_type {command} { }; # assert_bash_type() -# Make sure the expected items are also returned by TAB-completing the -# specified 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" +# @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 {expected cmd {test ""} {prompt /@} {size 20}} { @@ -78,9 +80,14 @@ proc assert_complete {expected cmd {test ""} {prompt /@} {size 20}} { if {[llength $expected] == 1} { pass "$test" } else { + # Remove optional (partial) argument from `cmd'. + # E.g. "finger test@" becomes "finger" + set cmd2 [lindex [split $cmd] 0] + # Determine common prefix of completions set common [::textutil::string::longestCommonPrefixList $expected] + if {[string length $common] > 0} {set common " $common"} expect { - -ex "$prompt$cmd$common" { pass "$test" } + -ex "$prompt$cmd2$common" { pass "$test" } -re $prompt { unresolved "$test at prompt" } -re eof { unresolved "eof" } }; # expect @@ -98,6 +105,7 @@ proc assert_complete {expected cmd {test ""} {prompt /@} {size 20}} { # @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}} { @@ -127,7 +135,7 @@ proc assert_complete_any {cmd {test ""} {prompt /@}} { regsub -all {([\[\]\(\)\.\\\+])} $cmd {\\\1} cmd expect { -re "^\r\n.*$prompt$cmd$" { pass "$test" } - -re /@ { unresolved "$test at prompt" } + -re $prompt { unresolved "$test at prompt" } -re eof { unresolved "eof" } }; # expect }; # assert_complete_any() @@ -136,7 +144,14 @@ proc assert_complete_any {cmd {test ""} {prompt /@}} { # 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. -# E.g.: s/COMP_PATH=.*/COMP_PATH=PATH/ +# Example calls: +# +# # Replace `COMP_PATH=.*' with `COMP_PATH=PATH' +# assert_env_unmodified {s/COMP_PATH=.*/COMP_PATH=PATH/} +# +# # Remove lines containing with `OLDPWD=' +# assert_env_unmodified {/OLDPWD=/d} +# # @param string $file Filename to generate environment save file from. See # `gen_env_filename()'. # @param string $diff Expected diff output (after being processed by $sed) @@ -328,11 +343,12 @@ proc _save_env {{file ""}} { # Interrupt completion and sync with prompt. # Send signals QUIT & INT. -proc sync_after_int {} { +# @param string $prompt (optional) Bash prompt. Default is "/@" +proc sync_after_int {{prompt /@}} { set test "Sync after INT" sleep .1 send \031\003; # QUIT/INT - expect /@ + expect $prompt }; # sync_after_int() |