summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/tcltest.n26
1 files changed, 15 insertions, 11 deletions
diff --git a/doc/tcltest.n b/doc/tcltest.n
index daa69d3..e9d0549 100644
--- a/doc/tcltest.n
+++ b/doc/tcltest.n
@@ -8,7 +8,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: tcltest.n,v 1.34 2002/09/06 17:43:00 dgp Exp $
+'\" RCS: @(#) $Id: tcltest.n,v 1.35 2002/09/06 20:46:15 dgp Exp $
'\"
.so man.macros
.TH "tcltest" n 2.1 tcltest "Tcl Bundled Packages"
@@ -380,7 +380,7 @@ the expected result. Some configuration options of \fBtcltest\fR
also influence how [\fBtest\fR] operates.
.PP
The valid options for [\fBtest\fR] are summarized:
-.DS
+.CS
.ta 0.8i
test \fIname\fR \fIdescription\fR
?-constraints \fIkeywordList|expression\fR?
@@ -392,12 +392,12 @@ test \fIname\fR \fIdescription\fR
?-errorOutput \fIexpectedError\fR?
?-returnCodes \fIcodeList\fR?
?-match \fImode\fR?
-.DE
+.CE
The \fIname\fR may be any string. It is conventional to choose
a \fIname\fR according to the pattern:
-.DS
+.CS
\fItarget\fR-\fImajorNum\fR.\fIminorNum\fR
-.DE
+.CE
For white-box (regression) tests, the target should be the name of the
C function or Tcl procedure being tested. For black-box tests, the
target should be the name of the feature being tested. Some conventions
@@ -911,6 +911,7 @@ test example-1.3 {user owns created files} -constraints {
removeFile test
} -result $::tcl_platform(user)
.CE
+.PP
At the next higher layer of organization, several [\fBtest\fR] commands
are gathered together into a single test file. Test files should have
names with the \fB.test\fR extension, because that is the default pattern
@@ -920,8 +921,8 @@ It is good practice to edit the test file and the source code file
together, keeping tests synchronized with code changes.
.PP
Most of the code in the test file should be the [\fBtest\fR] commands.
-Use constraints to skip tests, rather than condition running
-of [\fBtest\fB]. That is, do this:
+Use constraints to skip tests, rather than conditional evaluation
+of [\fBtest\fR]. That is, do this:
.IP [5]
.CS
testConstraint X [expr $myRequirement]
@@ -938,15 +939,16 @@ if $myRequirement {
} result
}
.CE
+.PP
Use the \fB-setup\fR and \fB-cleanup\fR options to establish and release
all context requirements of the test body. Do not make tests depend on
prior tests in the file. Those prior tests might be skipped. If several
consecutive tests require the same context, the appropriate setup
and cleanup scripts may be stored in variable for passing to each tests
-\fB-setup\fR and \fB-cleanup\fB options. This is a better solution than
+\fB-setup\fR and \fB-cleanup\fR options. This is a better solution than
performing setup outside of [\fBtest\fR] commands, because the setup will
only be done if necessary, and any errors during setup will be reported,
-and not cause the test suite to abort.
+and not cause the test file to abort.
.PP
A test file should be able to be combined with other test files and not
interfere with them, even when [\fBconfigure -singleproc 1\fR] causes
@@ -987,6 +989,7 @@ namespace eval ::example::test {
}
namespace delete ::example::test
.CE
+.PP
The next level of organization is a full test suite, made up of several
test files. One script is used to control the entire suite. The
basic function of this script is to call [\fBrunAllTests\fR] after
@@ -994,12 +997,13 @@ doing any necessary setup. This script is usually named \fBall.tcl\fR
because that's the default name used by [\fBrunAllTests\fR] when combining
multiple test suites into one testing run.
.IP [8]
-Here is a sketch of a sample test suite master file:
+Here is a sketch of a sample test suite master script:
.CS
package require Tcl 8.4
package require tcltest 2.2
package require example
-tcltest::configure -testdir [file dir [file normalize [info script]]]
+tcltest::configure -testdir \
+ [file dir [file normalize [info script]]]
eval tcltest::configure $argv
tcltest::runAllTests
.CE