(testsuite) `assert_complete' uses common prefix

Fix `assert_complete' to expect the longest common prefix to be presented as completion.
When trying to do a:

    package require textutil::string

it appeared DejaGnu overwrites `unknown', the tcl function that is called to attempt autoloading.  A workaround is used for tcl auto-loading to work: `init.tcl' is reloaded to restore the original `unknown' function:

    source [file join [info library] init.tcl]

See also: http://fvue.nl/wiki/DejaGnu:_proc_"tclPkgUnknown_..."_does_not_exist
This commit is contained in:
Freddy Vulto 2009-07-12 21:37:57 +02:00
parent 262c91b486
commit 7cdd205e76

View File

@ -1,3 +1,11 @@
# Source `init.tcl' again to restore the `unknown' procedure
# NOTE: DejaGnu has an old `unknown' procedure which unfortunately disables
# tcl auto-loading.
source [file join [info library] init.tcl]
package require textutil::string
# Execute a bash command and make sure the exit status is succesful.
# If not, output the error message.
# @param string $cmd Bash command line to execute. If emptry string (""), the
@ -70,8 +78,9 @@ proc assert_complete {expected cmd {test ""} {prompt /@} {size 20}} {
if {[llength $expected] == 1} {
pass "$test"
} else {
set common [::textutil::string::longestCommonPrefixList $expected]
expect {
-ex "$prompt$cmd" { pass "$test" }
-ex "$prompt$cmd$common" { pass "$test" }
-re $prompt { unresolved "$test at prompt" }
-re eof { unresolved "eof" }
}; # expect