Changeset 22036 in project


Ignore:
Timestamp:
12/17/10 05:25:14 (9 years ago)
Author:
Jim Ursetto
Message:

wiki/test: light up syntax and procedures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/test

    r20733 r22036  
    22
    33== test
     4
     5Yet another testing utility.
     6
     7[[toc:]]
    48
    59=== Usage
     
    1014</enscript>
    1115
    12 === Description
     16=== Interface
    1317
    1418This is designed to be as simple and friendly as possible.
    15 The basic interface
    1619
    17 <enscript language=scheme>
    18   (test [<name>] <expected-value> <expression>)
    19 </enscript>
     20<syntax>(test [<name>] <expected-value> <expression>)</syntax>
    2021
    21 is really all you need to use.  It will catch errors and
     22The basic test interface; really all you need to use.  It will catch errors and
    2223print informative failure messages, including the name
    2324(which defaults to an abbreviated form of the test expression),
     
    3132throughout a range of tests.
    3233
    33 Two other test macros are
     34<syntax>(test-assert [<name>] <expression>)</syntax>
     35<syntax>(test-error [<name>] <expression>)</syntax>
    3436
    35 <enscript language=scheme>
    36   (test-assert [<name>] <expression>)
    37   (test-error [<name>] <expression>)
    38 </enscript>
     37Convenience wrappers around {{test}}. {{test-assert}} asserts that the
     38expression is non-false; {{test-error}} asserts that the expression
     39results in an error.
    3940
    40 which simply assert that the expression is non-false and
    41 results in an error, respectively.
     41<syntax>(test-begin [<name>])</syntax>
     42<syntax>(test-end [<name>])</syntax>
    4243
    43 Group reporting, including elapsed time and pass percentages,
     44Test group reporting, including elapsed time and pass percentages,
    4445can be achieved using
    4546
    4647<enscript language=scheme>
    47   (test-begin [<name>])
    48   (test ...)
    49   ...
    50   (test-end [<name>])
     48 (test-begin [<name>])
     49 (test ...)
     50 ...
     51 (test-end [<name>])
    5152</enscript>
    5253
    5354where the group name is optional in either case.
    5455
    55 You can also group in a single lexical scope (and also establish
    56 nested groups) with the TEST-GROUP macro
     56<syntax>(test-group <name> ...)</syntax>
     57
     58You can group tests in a single lexical scope (and also establish
     59nested groups) with the {{test-group}} macro:
    5760
    5861<enscript language=scheme>
    59   (test-group <name>
    60     (test ...)
    61     ...
    62     )
     62 (test-group <name>
     63   (test ...)
     64   ...
     65 )
    6366</enscript>
    6467
    65 The name for TEST-GROUP is not optional.
     68The name for {{test-group}} is not optional.
    6669
    67 As a convenience there is a TEST-EXIT procedure, which
     70<procedure>(test-exit [<failure-exit-code>])</procedure>
     71
     72As a convenience there is a {{test-exit}} procedure, which
    6873exits the process with a status of 0 if all tests in all
    6974groups have passed, and with an optional numeric
     
    7176or errors.
    7277
    73 <enscript language=scheme>
    74   (test-exit [<failure-exit-code>])
    75 </enscript>
     78=== Parameters
    7679
    77 That's all.  All other aspects of testing are controlled by
    78 parameters.
    79 
    80 === Parameters
     80All other aspects of testing are controlled by parameters.
    8181
    8282<parameter>current-test-verbosity</parameter>
    8383
    8484Default to {{#t}}, prints full diagnostics for failures
    85 
    8685
    8786<parameter>current-test-epsilon</parameter>
     
    101100List of predicates to filter entire test groups
    102101
    103 
    104 
    105 The following parameters can be used to override the reporting
    106 behavior, for example if you wanted a GUI interface instead of
    107 the default textual reporting.
    108 
    109102<parameter>current-test-applier</parameter>
    110103<parameter>current-test-handler</parameter>
    111104<parameter>current-test-skipper</parameter>
    112105<parameter>current-test-group-reporter</parameter>
     106
     107These parameters can be used to override the reporting
     108behavior, for example if you wanted a GUI interface instead of
     109the default textual reporting.
    113110
    114111=== Environment
     
    157154BSD
    158155
     156=== Author
     157
     158Alex Shinn
     159
    159160=== History
    160161
Note: See TracChangeset for help on using the changeset viewer.