You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The draft patch below adds -output and -errorOutput options to jimtcl tcltest.
As per the original tcltest suite, it uses a (simple) custom puts command which captures its output. For example, to capture stdout from a C/shell program, use puts [exec C-Program/shell-program] as the -body script. If an error is expected, exec C-Program should work (in -body).
It has been tested for the following testfile (and also using make test in jimtcl, just to confirm it does not cause problems, although it
is not really exercised by make test in jimtcl):
source tcltest.tcl
test test1 {test -output option} -body {puts hi} -output {hi
}
test test2 {test -errorOutput option} -body {
puts hi hi
} -errorOutput {invalid command name "hi"
}
tcltest::cleanupTests
When there is an error, it prints the expected and actual values of -output and -errorOutput with \t, \r and \n indicated visibly so as to make certain whitespace discrepancies more obvious. This is a potential improvement on the original tcltest suite.
It uses a UUID value to signify absence of -output or -errorOutput values, so that a null -output or -errorOutput string can be used to easily capture the actual output. For example, to capture the output of test1 below, use an empty -output string for matching, as indicated. Then the actual string can be copied from the tcltest output into -output, although any \t, \r or \n have to be converted into a tab or carriage return respectively, and any visible \n characters have to be deleted (but leave the actual newline):
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The draft patch below adds -output and -errorOutput options to jimtcl tcltest.
As per the original tcltest suite, it uses a (simple) custom puts command which captures its output. For example, to capture stdout from a C/shell program, use
puts [exec C-Program/shell-program]
as the-body
script. If an error is expected,exec C-Program
should work (in-body
).It has been tested for the following testfile (and also using
make test
in jimtcl, just to confirm it does not cause problems, although itis not really exercised by
make test
in jimtcl):When there is an error, it prints the expected and actual values of -output and -errorOutput with
\t
,\r
and\n
indicated visibly so as to make certain whitespace discrepancies more obvious. This is a potential improvement on the original tcltest suite.It uses a UUID value to signify absence of -output or -errorOutput values, so that a null -output or -errorOutput string can be used to easily capture the actual output. For example, to capture the output of test1 below, use an empty -output string for matching, as indicated. Then the actual string can be copied from the tcltest output into -output, although any
\t
,\r
or\n
have to be converted into a tab or carriage return respectively, and any visible\n
characters have to be deleted (but leave the actual newline):Patch is:
Beta Was this translation helpful? Give feedback.
All reactions