Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 0df67f45cb1faf2c90c4abc827feda48fb06dd66
Ticket: 541637ffffffffffffffffffffffffffffffffff
{puts stdout $msg} fails inside test
User & Date: dgp on 2002-06-26 08:11:36
Changes

  1. closedate changed to: "2002-06-26T01:11:36"
  2. closer changed to: "dgp"
  3. icomment:
    Logged In: YES 
    user_id=80530
    
    
    uggghhhh.  Issue 3 has to do with how to interpret the second
    form of the tcltest::test command.  tcltest::test recognizes two
    documented syntaxes:
    
        test $name $description ?$opt $val ...?
    
    and
    
        test $name $description $singleArgumentToBeParsed
    
    Supposedly the second form is helpful because it lets one
    enclose everything in braces and avoid a lot of backslash
    quoting
    of newlines.  Trouble is that the rules for parsing that single
    argument (what substitutions are done?  in what context?) are
    never documented clearly, and the code that implements that
    parsing is a maze of obfuscation.  I think the code is probably
    wrong, but I think it's wrong to even offer the second syntax.
    Tcl has simple quoting rules; why muck up this command with
    its own undocumented special parsing syntax.
    
    The backslash newline issues can be just about completely
    addressed by a coding convention that places the newlines
    within arguments that are brace-quoted anyway.  See
    main.test for an example.
    
    But, I'm not going to change that now.  Whatever voodoo is
    in there, there must be some test suite somewhere that's
    using it, so I don't dare change it.  Indeed when I disabled
    the [concat] voodoo, tests in the Tcl test suite indeed did 
    begin to fail.
    
    Instead, I just recommend that you do not use the second
    syntax in your own test suites.  It is documented that
    the two forms can behave differently.  From my perspective,
    the first form is predictable (if you know Tcl substitution
    rules);
    the second form is not.  As you've discovered, the second
    form can cause the dropping of trailing whitespace that can
    be important.
    
    Rewrite your foo.test as:
    
      test CLR-1.1 {...} -body {
        puts stdout here...
      } -result {} -output "here\n"
    
    and go forward and prosper.
    
    
  4. login: "dgp"
  5. mimetype: "text/plain"
  6. resolution changed to: "Wont Fix"
  7. status changed to: "Closed"
  8. username: "dgp"