|
|
test creates an instance that contains at least two strings of
code. This code is executed and compared with 'equal'.
If the values are equal, the success field of the test instance is set to true,
otherwise its set to false. The test instance is returned.
The to_html method for test prints "Passed Test" if the test succeeded and
"Failed Test" plus details if it didn't.
The second argument defaults to true so if evaluating your first argument is
supposed to return true, you need only pass one argument to "test".
<test result=12
<set x = 10/>
x.<plus 2/>
/>source arg along with both
expressions to compare and let the result arg default to true.
You will find particularly useful calls to the methods:
is equal not
You can give test additional fields of:
name - a string to identify the test pre_code - test setup code to execute before the test is run.post_code - test teardown code to execute after the test is run.result=error
To execute the source and verify that it runs, but ignore the result,
use result=ignore
To not run a test at all, use do_not_run=true . This is useful when running
the test will cause undesired results. To change the default for all tests, use
test.<set do_not_run = true/>
Sometimes a test fails, but it can't be fixed immediately and it is helpful
to indicate that the test fails. Use known_bug=true .
If it is testing a feature that is not yet implemented,
use known_bug="not_yet_implemented"
In some cases, a test will have several effects. To test for multiple
effects, have the test source return a vector where each value
is an expression to test. The test result is a vector where each value
is the expected result.
<test result=<vector 10 20/>
thing.<set x = 10/>
thing.<set y = 20/>
<vector thing.x thing.y/>
/>© Copyright 2007 Clear Methods, Inc.