Verified Commit 34a479b0 authored by Camil Staps's avatar Camil Staps 🚀

Improve documentation about @property

parent f7c26a57
......@@ -121,19 +121,24 @@ do), `CloogleDBFactory` can derive the type.</sup>
With [clean-test][]'s `maketest` tool, [Gast][] test programs can be generated
with properties from docblocks. For this, several additional fields can be
used, which are further documented by [clean-test][]:
- `@property` on functions describes the actual property to test. An example
is: `@property plus_commutative: A. x :: a; y :: a: x + y == y + x`. This
will test the property `\x y -> x + y == y + x` where `x` and `y` are of type
`a`.
- `@property-test-with` indicates how to instantiate type variables (it is not
always required). For the above property, suitable doclines are
`@property-test-with a = Int` and `@property-test-with a = Real`. This
docfield has to be given on the same function as the corresponding
`@property`.
- `@property-bootstrap` on a module can be used to add bootstrap code, like
imports, to the generated test program.
used, which are further documented by [clean-test][].
Briefly, `@property` on functions describes the actual property. When this uses
type variables, `@property-test-with` can be used to show how to instantiate
them. On the module, `@property-bootstrap` can be used to add bootstrap code,
like imports, to the top of the program. For example:
```clean
/**
* @property plus_commutative: A. x :: a; y :: a:
* x + y == y + x
* @property-test-with a = Int
* @property-test-with a = Real
*/
```
This will test the property `\x y -> x + y == y + x` where `x` and `y` are of
type `Int` or `Real`.
## Copyright &amp; License
Copyright &copy; 2016-present Mart Lubbers and Camil Staps.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment