Reviewed tests a*
This commit is contained in:
parent
ad1b60a3de
commit
3d723502c9
@ -1 +0,0 @@
|
||||
source "lib/completions/add_members.exp"
|
@ -1 +0,0 @@
|
||||
source "lib/completions/arch.exp"
|
@ -1 +0,0 @@
|
||||
source "lib/completions/arpspoof.exp"
|
3
test/completion/add_members.exp
Normal file
3
test/completion/add_members.exp
Normal file
@ -0,0 +1,3 @@
|
||||
if {[assert_bash_type {add_members}]} {
|
||||
source "lib/completions/add_members.exp"
|
||||
}; # if
|
3
test/completion/arch.exp
Normal file
3
test/completion/arch.exp
Normal file
@ -0,0 +1,3 @@
|
||||
if {[assert_bash_type {arch}]} {
|
||||
source "lib/completions/arch.exp"
|
||||
}; # if
|
3
test/completion/arpspoof.exp
Normal file
3
test/completion/arpspoof.exp
Normal file
@ -0,0 +1,3 @@
|
||||
if {[assert_bash_type {arpspoof}]} {
|
||||
source "lib/completions/arpspoof.exp"
|
||||
}; # if
|
@ -1,5 +1,8 @@
|
||||
# Set default expect fallback routines
|
||||
expect_after {
|
||||
if {![info exists test]} {
|
||||
set test [info level 1]
|
||||
}; # if
|
||||
eof { fail "$test at eof" }
|
||||
timeout { fail "$test at timeout" }
|
||||
}; # expect_after()
|
||||
|
20
test/lib/completions/a2ps.exp
Normal file
20
test/lib/completions/a2ps.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "a2ps "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
20
test/lib/completions/acroread.exp
Normal file
20
test/lib/completions/acroread.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
assert_bash_exec "touch fixture1/t.pdf"; # Create temporary files
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_bash_exec "rm fixture1/t.pdf"; # Remove temporary files
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete {"bar bar.d/" foo.d/ t.pdf} "acroread fixture1/"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
20
test/lib/completions/add_members.exp
Normal file
20
test/lib/completions/add_members.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "add_members -"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
20
test/lib/completions/animate.exp
Normal file
20
test/lib/completions/animate.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "animate "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
28
test/lib/completions/ant.exp
Normal file
28
test/lib/completions/ant.exp
Normal file
@ -0,0 +1,28 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}; # teardown()
|
||||
|
||||
|
||||
if {[assert_bash_type ant]} {
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "ant -"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
||||
|
||||
|
||||
}; # if
|
||||
|
||||
|
20
test/lib/completions/apt-build.exp
Normal file
20
test/lib/completions/apt-build.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "apt-build "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
20
test/lib/completions/apt-cache.exp
Normal file
20
test/lib/completions/apt-cache.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "apt-cache "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
22
test/lib/completions/apt-get.exp
Normal file
22
test/lib/completions/apt-get.exp
Normal file
@ -0,0 +1,22 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set commands {autoclean autoremove build-dep check clean dist-upgrade
|
||||
dselect-upgrade install purge remove source update upgrade}
|
||||
assert_complete $commands "apt-get "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
20
test/lib/completions/aptitude.exp
Normal file
20
test/lib/completions/aptitude.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "aptitude "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
21
test/lib/completions/arch.exp
Normal file
21
test/lib/completions/arch.exp
Normal file
@ -0,0 +1,21 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set options {--wipe -s --start= -e --end= -q --quiet -h --help}
|
||||
assert_complete $options "arch -"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
20
test/lib/completions/arpspoof.exp
Normal file
20
test/lib/completions/arpspoof.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "arpspoof -"
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
20
test/lib/completions/aspell.exp
Normal file
20
test/lib/completions/aspell.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "aspell "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
20
test/lib/completions/autoconf.exp
Normal file
20
test/lib/completions/autoconf.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "autoconf "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
20
test/lib/completions/automake.exp
Normal file
20
test/lib/completions/automake.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "automake "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
20
test/lib/completions/awk.exp
Normal file
20
test/lib/completions/awk.exp
Normal file
@ -0,0 +1,20 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "awk "
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
@ -1,26 +0,0 @@
|
||||
proc setup {} {
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set test "Tab should complete"
|
||||
# Try completion
|
||||
set cmd "a2ps "
|
||||
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
|
@ -1,35 +0,0 @@
|
||||
proc setup {} {
|
||||
set test setup
|
||||
set cmd "touch fixture1/t.pdf"; # Create temporary files
|
||||
send "$cmd\r"
|
||||
expect -ex "$cmd\r\n/@"
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
set test teardown
|
||||
set cmd "rm fixture1/t.pdf"; # Remove temporary files
|
||||
send "$cmd\r"
|
||||
expect -ex "$cmd\r\n/@"
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set test "Tab should complete acroread"
|
||||
# Try completion
|
||||
set cmd "acroread fixture1/"
|
||||
send "$cmd\t"
|
||||
expect {
|
||||
-re "^${cmd}\r\n(\.svn/ +|)bar bar.d/ +foo.d/ +(\.svn/ +|)t.pdf *\r\n/@$cmd$" { pass "$test" }
|
||||
-re /@ { unresolved "$test at prompt" }
|
||||
default { unresolved "$test" }
|
||||
}; # expect
|
||||
|
||||
|
||||
sleep .5
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
@ -1,26 +0,0 @@
|
||||
proc setup {} {
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set test "Tab should complete"
|
||||
# Try completion
|
||||
set cmd "add_members -"
|
||||
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
|
@ -1,26 +0,0 @@
|
||||
proc setup {} {
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set test "Tab should complete"
|
||||
# Try completion
|
||||
set cmd "animate "
|
||||
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
|
@ -1,34 +0,0 @@
|
||||
proc setup {} {
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
}; # teardown()
|
||||
|
||||
|
||||
if {[assert_bash_type ant]} {
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set test "Tab should complete"
|
||||
# Try completion
|
||||
set cmd "ant -"
|
||||
send "$cmd\t"
|
||||
expect {
|
||||
-re "^$cmd\r\n.*\r\n/@$cmd$" { pass "$test" }
|
||||
-re /@ { unresolved "$test at prompt" }
|
||||
-re eof { unresolved "eof" }
|
||||
}; # expect
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
||||
|
||||
|
||||
}; # if
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
proc setup {} {
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set test "Tab should complete"
|
||||
# Try completion
|
||||
set cmd "apt-build "
|
||||
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
|
@ -1,26 +0,0 @@
|
||||
proc setup {} {
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set test "Tab should complete"
|
||||
# Try completion
|
||||
set cmd "apt-cache "
|
||||
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
|
@ -1,26 +0,0 @@
|
||||
proc setup {} {
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set test "Tab should complete"
|
||||
# Try completion
|
||||
set cmd "apt-get "
|
||||
send "$cmd\t"
|
||||
expect {
|
||||
-re "$cmd\r\nautoclean\\s+autoremove\\s+build-dep\\s+check\\s+clean\\s+dist-upgrade\\s+dselect-upgrade\\s+install/\r\npurge\\s+remove\\s+source\\s+update\\s+upgrade\\s*\r\n/@$cmd$" { pass "$test" }
|
||||
-re /@ { unresolved "$test at prompt" }
|
||||
-re eof { unresolved "eof" }
|
||||
}; # expect
|
||||
|
||||
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
@ -1,26 +0,0 @@
|
||||
proc setup {} {
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set test "Tab should complete"
|
||||
# Try completion
|
||||
set cmd "aptitude "
|
||||
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
|
@ -1,31 +0,0 @@
|
||||
proc setup {} {
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set test "Tab should complete"
|
||||
# Try completion
|
||||
set cmd "arch -"
|
||||
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; # Control-c
|
||||
expect -ex /@
|
||||
|
||||
|
||||
teardown
|
@ -1,26 +0,0 @@
|
||||
proc setup {} {
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set test "Tab should complete"
|
||||
# Try completion
|
||||
set cmd "arpspoof -"
|
||||
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
|
@ -1,26 +0,0 @@
|
||||
proc setup {} {
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set test "Tab should complete"
|
||||
# Try completion
|
||||
set cmd "aspell "
|
||||
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
|
@ -1,26 +0,0 @@
|
||||
proc setup {} {
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set test "Tab should complete"
|
||||
# Try completion
|
||||
set cmd "autoconf "
|
||||
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
|
@ -1,31 +0,0 @@
|
||||
proc setup {} {
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set test "Tab should complete"
|
||||
# Try completion
|
||||
set cmd "automake "
|
||||
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 .1
|
||||
send \031\003; # QUIT/INT
|
||||
expect -ex /@
|
||||
|
||||
|
||||
teardown
|
@ -1,26 +0,0 @@
|
||||
proc setup {} {
|
||||
}; # setup()
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
}; # teardown()
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
set test "Tab should complete"
|
||||
# Try completion
|
||||
set cmd "awk "
|
||||
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
|
@ -43,6 +43,18 @@ proc assert_bash_type {command} {
|
||||
}; # assert_bash_type()
|
||||
|
||||
|
||||
# Make sure any completions are returned
|
||||
proc assert_complete_any {cmd {test ""} {prompt /@}} {
|
||||
if {$test == ""} {set test "$cmd should show completions"}
|
||||
send "$cmd\t"
|
||||
expect {
|
||||
-re "^$cmd\r\n.*$prompt$cmd$" { pass "$test" }
|
||||
-re /@ { unresolved "$test at prompt" }
|
||||
-re eof { unresolved "eof" }
|
||||
}; # expect
|
||||
}; # assert_complete_any()
|
||||
|
||||
|
||||
# Make sure the expected items are also returned by TAB-completing the
|
||||
# specified command.
|
||||
# Break items into chunks because `expect' seems to have a limited buffer size
|
||||
|
Loading…
x
Reference in New Issue
Block a user