Reviewed tests h* & i*

Localized `i' variable in `info' completion.
This commit is contained in:
Freddy Vulto 2009-07-18 16:55:23 +02:00
parent c6af1bf435
commit 11302d4038
69 changed files with 399 additions and 542 deletions

View File

@ -6,7 +6,7 @@
have info && have info &&
_info() _info()
{ {
local cur infopath local cur i infopath
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`

View File

@ -1 +0,0 @@
source "lib/completions/head.exp"

View File

@ -1 +0,0 @@
source "lib/completions/hg.exp"

View File

@ -1 +0,0 @@
source "lib/completions/iconv.exp"

View File

@ -1 +0,0 @@
source "lib/completions/id.exp"

View File

@ -1 +0,0 @@
source "lib/completions/identify.exp"

View File

@ -1 +0,0 @@
source "lib/completions/ifdown.exp"

View File

@ -1 +0,0 @@
source "lib/completions/ifup.exp"

View File

@ -1 +0,0 @@
source "lib/completions/indent.exp"

View File

@ -1 +0,0 @@
source "lib/completions/info.exp"

View File

@ -1 +0,0 @@
source "lib/completions/inject.exp"

View File

@ -1 +0,0 @@
source "lib/completions/insmod.exp"

View File

@ -1 +0,0 @@
source "lib/completions/invoke-rc.d.exp"

View File

@ -1 +0,0 @@
source "lib/completions/irb.exp"

View File

@ -1 +0,0 @@
source "lib/completions/isql.exp"

3
test/completion/head.exp Normal file
View File

@ -0,0 +1,3 @@
if {[assert_bash_type {head}]} {
source "lib/completions/head.exp"
}; # if

View File

@ -0,0 +1,3 @@
if {[assert_bash_type {iconv}]} {
source "lib/completions/iconv.exp"
}; # if

3
test/completion/id.exp Normal file
View File

@ -0,0 +1,3 @@
if {[assert_bash_type {id}]} {
source "lib/completions/id.exp"
}; # if

View File

@ -0,0 +1,3 @@
if {[assert_bash_type {convert}]} {
source "lib/completions/identify.exp"
}; # if

View File

@ -0,0 +1,3 @@
if {[assert_bash_type {ifdown}]} {
source "lib/completions/ifdown.exp"
}; # if

3
test/completion/ifup.exp Normal file
View File

@ -0,0 +1,3 @@
if {[assert_bash_type {ifup}]} {
source "lib/completions/ifup.exp"
}; # if

View File

@ -0,0 +1,3 @@
if {[assert_bash_type {indent}]} {
source "lib/completions/indent.exp"
}; # if

3
test/completion/info.exp Normal file
View File

@ -0,0 +1,3 @@
if {[assert_bash_type {info}]} {
source "lib/completions/info.exp"
}; # if

View File

@ -0,0 +1,3 @@
if {[assert_bash_type {inject}]} {
source "lib/completions/inject.exp"
}; # if

View File

@ -0,0 +1,3 @@
if {[assert_bash_type {insmod}]} {
source "lib/completions/insmod.exp"
}; # if

View File

@ -0,0 +1,3 @@
if {[assert_bash_type {invoke-rc.d}]} {
source "lib/completions/invoke-rc.d.exp"
}; # if

3
test/completion/irb.exp Normal file
View File

@ -0,0 +1,3 @@
if {[assert_bash_type {irb}]} {
source "lib/completions/irb.exp"
}; # if

3
test/completion/isql.exp Normal file
View File

@ -0,0 +1,3 @@
if {[assert_bash_type {isql}]} {
source "lib/completions/isql.exp"
}; # if

3
test/fixtures/isql/odbc.ini vendored Normal file
View File

@ -0,0 +1,3 @@
[foo]
[bar]

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "head --"
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "iconv "
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "id -"
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "identify -"
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "ifdown "
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "ifup "
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "indent --"
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "info "
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "inject "
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "insmod in"
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "invoke-rc.d "
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "irb "
sync_after_int
teardown

View File

@ -0,0 +1,23 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified {/ODBCINI=/d}
}; # teardown()
setup
assert_bash_exec {OLDODBCINI=$ODBCINI; ODBCINI=$TESTDIR/fixtures/isql/odbc.ini}
assert_complete_any "isql "
sync_after_int
assert_bash_exec {ODBCINI=$OLDODBCINI; unset -v OLDODBCINI}
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "iwconfig --"
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "iwlist --"
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_complete_any "iwpriv --"
sync_after_int
teardown

View File

@ -0,0 +1,20 @@
proc setup {} {
save_env
}; # setup()
proc teardown {} {
assert_env_unmodified
}; # teardown()
setup
assert_env_unmodified "iwspy --"
sync_after_int
teardown

View File

@ -1,26 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should complete"
# Try completion
set cmd "head "
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

View File

@ -1,26 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should complete"
# Try completion
set cmd "hg -R "
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

View File

@ -1,26 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should complete"
# Try completion
set cmd "iconv "
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

View File

@ -1,26 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should complete"
# Try completion
set cmd "id "
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

View File

@ -1,26 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should complete"
# Try completion
set cmd "identify "
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

View File

@ -1,27 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should complete"
# Try completion
set cmd "ifdown "
send "$cmd\t"
expect {
-re "^$cmd.*$" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
-re eof { unresolved "eof" }
}; # expect
sleep .5
sync_after_int
teardown

View File

@ -1,44 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should show completions"
# Try completion
set cmd "ifup "
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 "Argument should complete"
# Set test function for _configured_interfaces()
set cmd "_configured_interfaces() { COMPREPLY=( foo bar ); }"
send "$cmd\r"
expect -ex "$cmd\r\n/@"
# Try completion
set cmd "ifup f"
send "$cmd\t"
expect {
-re "^${cmd}oo\\s*$" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
-re eof { unresolved "eof" }
}; # expect
sync_after_int
teardown

View File

@ -1,26 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should complete"
# Try completion
set cmd "indent "
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

View File

@ -1,31 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should complete"
# Try completion
set cmd "info "
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 QUIT/INT"
sleep 0.01
send \031\003
expect -ex /@
teardown

View File

@ -1,26 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should complete"
# Try completion
set cmd "inject "
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

View File

@ -1,26 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should show completions"
# Try completion
set cmd "insmod in"
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

View File

@ -1,26 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should complete"
# Try completion
set cmd "invoke-rc.d "
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

View File

@ -1,26 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should complete"
# Try completion
set cmd "irb "
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

View File

@ -1,34 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should show completions"
# Try completion
set cmd "isql "
send "$cmd\t"
expect {
# TODO: If $ODBCINI is set, match completions
# -- FVu, Fri Feb 27 22:58:05 CET 2009
-re "^$cmd.*" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
-re eof { unresolved "eof" }
}; # expect
# Because we don't wait for prompt (/@), wait a moment
# for `comp_load' to install real completion. This can
# be removed if the TODO above is fixed.
# -- FVu, Fri Feb 27 23:14:49 CET 2009
sleep .5
sync_after_int
teardown

View File

@ -1,40 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should complete"
# Try completion
set cmd "iwconfig --"
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 not complain about _available_interfaces() not being available"
# Try completion
set cmd "iwconfig #"
send "$cmd\t"
expect {
-re "^$cmd$" { pass "$test" }
-re /@ { unresolved "$test at prompt" }
-re eof { unresolved "eof" }
}; # expect
sync_after_int
teardown

View File

@ -1,31 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should complete"
# Try completion
set cmd "iwlist --"
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

View File

@ -1,26 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should complete"
# Try completion
set cmd "iwpriv --"
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

View File

@ -1,31 +0,0 @@
proc setup {} {
}; # setup()
proc teardown {} {
}; # teardown()
setup
set test "Tab should complete"
# Try completion
set cmd "iwspy --"
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 QUIT/INT"
sleep 0.01
send \031\003; # QUIT/INT
expect -ex /@
teardown

View File

@ -134,13 +134,23 @@ proc assert_complete_any {cmd {test ""} {prompt /@}} {
# Escape special regexp characters # Escape special regexp characters
regsub -all {([\[\]\(\)\.\\\+])} $cmd {\\\1} cmd regsub -all {([\[\]\(\)\.\\\+])} $cmd {\\\1} cmd
expect { expect {
-timeout 1
# Match completions, multiple words
# NOTE: The `\S*' (zero or more non-whitespace characters) matches a # NOTE: The `\S*' (zero or more non-whitespace characters) matches a
# possible enlargement of a command's partial completion if the # longest common prefix of the completions shown.
# list of completions have a larger common prefix.
# E.g. `fmt -' becomes `fmt --' (two dashes) when completing # E.g. `fmt -' becomes `fmt --' (two dashes) when completing
-re "^\r\n.*$prompt$cmd\\S*$" { pass "$test" } -re "^\r\n.*$prompt$cmd\\S*$" { pass "$test" }
timeout {
expect {
# Match completion, single word. This word is shown on the
# same line as the command.
-re "^\\w+ $" { pass "$test" }
# Try matching multiple words again, with new timeout
-re "^\r\n.*$prompt$cmd\\S*$" { pass "$test" }
}
}
-re $prompt { unresolved "$test at prompt" } -re $prompt { unresolved "$test at prompt" }
-re eof { unresolved "eof" } eof { unresolved "eof" }
}; # expect }; # expect
}; # assert_complete_any() }; # assert_complete_any()