Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Correct wrong/misleading errorInfo reporting

Closed / Accepted1017151fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-08-26 20:02:10
Currently, the display of error information during a
test run can be misleading. In particular, the
errorInfo displayed for a test that was supposed to
have a returnCode of error but did not is that of the
last error. Also, if the body and cleanup sections of a
test throw errors, only the error from the cleanup
section is displayed. It would be helpful if both
pieces of information were reported.

Some sample code that shows the problem:

test fake-1.1 {
    A fake test to set errorInfo
} -body {
    catch { error "this is an error" }
} -result 1

test fakeError-1.1 {
    Show an error condition when there isn't one
} -body {
    set x 1
} -returnCodes error -result {1}

test lostError-1.1 {
    Lose the body error information
} -body {
    error "we never see this error"
} -cleanup {
    error "we only see this error"
} -result 1
robert_seegerplain2004-08-29 10:10:57
File Added - 99581: tcltestmod.tar.gz
robert_seegerplain2004-08-29 12:49:50
Logged In: YES 
user_id=1081558

The file I attached breaks the test 'tcltest-2.8', due to
the change in output on an error. The following rewrite of
the test (which only changes the regexp) makes all tests in
that file again pass.

test tcltest-2.8 {tcltest -verbose 'error'} {
    -constraints {unixOrPc}
    -body {
set result [slave msg test.tcl -verbose error]
list $result $msg
    }
    -result {errorInfo\(body\): foo.*errorCode\(body\): 9}
    -match regexp
}
dgp Ticket [1017151fff]: 1 change [History diff]2004-10-30 09:48:33
dgpplain2004-11-02 06:15:43
Logged In: YES 
user_id=80530

here's an adapted patch
against the HEAD.  What
do you think?
dgpplain2004-11-02 06:15:44
File Added - 107283: 1017151.patch
dgpplain2004-11-03 02:03:29
Logged In: YES 
user_id=80530

Fixed in tcltest 2.2.7
robert_seegerplain2004-11-08 21:51:44
Logged In: YES 
user_id=1081558

I just tested it out, and it looks great. Thanks very much
Log in (anonymous is fine) to add a comment.

Attachments: