Version 5 of How to write tcltest result values

Updated 2002-08-12 13:53:57

I think I must not understand tcltest. I love to write tests, but I find it difficult to compose the correct result values to achieve null differences. When I'm off at all, tcltest floods my screen with more characters than I can digest. The only way I'm able to cope is by feeding the stdout from a tcltest run into

    # Small utility to read tcltest, and report only the differences
    #    of the first failure.  This utility has no exception-handling,
    #    does not clean up after itself, ...
    set tmp /tmp/diff[pid]


    set report [read stdin]
    regexp -- \
    {---- Result was:(.*?)---- Result should have been:(.*)====} \
          $report -> first second
    foreach part {first second} {
            # If my Unix bias were any greater, I'd one-line
            #    "exec cat >$tmp$part <<[set $part]".
        set fp [open $tmp$part w]
        puts -nonewline $fp [set $part]
        close $fp
    }    
    catch {exec diff ${tmp}first ${tmp}second]} result
    puts "Result is:
    $result"

Is there an easier way?