From 7cdd205e76d5afd94d1e8342be4fa3895ec6ff36 Mon Sep 17 00:00:00 2001 From: Freddy Vulto Date: Sun, 12 Jul 2009 21:37:57 +0200 Subject: [PATCH] (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 --- test/lib/library.exp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/lib/library.exp b/test/lib/library.exp index 352d892a..b152ffb5 100644 --- a/test/lib/library.exp +++ b/test/lib/library.exp @@ -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