Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b3530ccde6a50e93596a309c74b4a330f49f771d
Ticket: 513983ffffffffffffffffffffffffffffffffff
invalid calls to [test] should throw errors
User & Date: kenstir on 2002-04-10 08:49:52
Changes

  1. icomment:
    
    
    File Added - 20897: patch.txt
    
    Logged In: YES 
    user_id=246646
    
    I would like to lobby a second time for this patch.  I have
    reconstructed Don's patch so that:
    
     1) it works on the latest CVS HEAD
     2) the tests pass
     3) the package version is incremented to 2.0.3
    
    This patch implements a contract (as in "programming by
    contract") between the caller and tcltest::test.  The
    contract is, "I supply you with a valid test and you run the
    test".  If the contract cannot be fulfilled, that is, if the
    test can't be run, then an error is thrown.
    
    I believe strongly that this contract is a more robust way
    to construct a large suite of tests.  Imagine that it
    weren't this way; how do I verify that my tests are valid? 
    Parse the output through the errorChannel?  That is not
    robust.  Wrap each call to 'test' in an 'if'?  This is not
    practical and so nobody does this.  Out of 10,000 tests in
    the tcl suite, only 2 calls (in tcltest.test) were checking
    the return status of 'test'.
    
    Tcltest has been greatly enhanced in 2.0, and it remains an
    excellent tool for validating software correctness.  I would
    be disappointed to see it compromised by allowing broken
    software to pass through its tests without anyone noticing
    the problem.
    
    Regards,
    Ken Cox
    
    
    
  2. login: "kenstir"
  3. mimetype: "text/plain"
  4. username: "kenstir"