Tcl Source Code

View Ticket
Login
Ticket UUID: 1017151
Title: Correct wrong/misleading errorInfo reporting
Type: RFE Version: None
Submitter: robert_seeger Created on: 2004-08-26 20:02:10
Subsystem: 34. tcltest Package Assigned To: dgp
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2004-11-08 21:51:44
Resolution: Accepted Closed By: dgp
    Closed on: 2004-11-02 19:03:29
Description:
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
User Comments: robert_seeger added on 2004-11-08 21:51:44:
Logged In: YES 
user_id=1081558

I just tested it out, and it looks great. Thanks very much

dgp added on 2004-11-03 02:03:29:
Logged In: YES 
user_id=80530

Fixed in tcltest 2.2.7

dgp added on 2004-11-02 06:15:44:

File Added - 107283: 1017151.patch

dgp added on 2004-11-02 06:15:43:
Logged In: YES 
user_id=80530

here's an adapted patch
against the HEAD.  What
do you think?

robert_seeger added on 2004-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
}

robert_seeger added on 2004-08-29 10:10:57:

File Added - 99581: tcltestmod.tar.gz

Attachments: