Tcl Source Code

View Ticket
Login
Ticket UUID: 2130388
Title: smart truncation of long lines in tcltest output
Type: RFE Version: None
Submitter: jan.nijtmans Created on: 2008-09-26 15:38:04
Subsystem: 34. tcltest Package Assigned To: dgp
Priority: 5 Medium Severity:
Status: Open Last Modified: 2014-02-21 19:11:26
Resolution: None Closed By:
    Closed on:
Description:
When tests fail, tcltest outputs something like:
  ---- Result was:
  abc
  ---- Result should have been (exact matching):
  def
  ==== foo-1.1 FAILED

When the two strings being compared are very
long, this becomes unreadable. junit has the
feature that in this case, the first and last
characters from both strings, as far as they
are equal are stripped and replaced with "..."
This way, you can see quickly which part of
the string is different, and what the difference
is. This feature I would like to see in tcltest
as well.
So, it could look like:
  ---- Result was:
  ...foobar ...
  ---- Result should have been (exact matching):
  ...fooBar ...
  ==== foo-1.1 FAILED

Therefore I made the following implementation
(see attached diff.txt file). If minimally
the first 8 characters are equal, the equal
part is replaced by "..." followed by the
last 3 equal characters. The last part of
the string is handled equivalently.

A lot of variations are possible, but I would
like some feedback/review before committing it.

Regards,
         Jan Nijtmans
User Comments: nijtmans added on 2008-09-28 04:07:48:
Don, thanks for taking this.

However, realizing that this patch only works well for
exact matching (not glob or regexp), it should be seen
as first attempt for this feature.

And a clear investigation what exact junit does would
be good as well.

nijtmans added on 2008-09-26 22:38:05:

File Added - 294995: diff.txt

Attachments: