aboutsummaryrefslogtreecommitdiffstats
path: root/doc/mcgoron.srfi.64.scm
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2025-01-19 12:32:15 -0500
committerGravatar Peter McGoron 2025-01-19 12:32:15 -0500
commit8aad8c9a0a535af721d0e72613ca5f5d3171017e (patch)
tree338a6e4d63fbfe697b0f381a8e66e9acd6f8674a /doc/mcgoron.srfi.64.scm
parentfix (diff)
rename
Diffstat (limited to 'doc/mcgoron.srfi.64.scm')
-rw-r--r--doc/mcgoron.srfi.64.scm71
1 files changed, 71 insertions, 0 deletions
diff --git a/doc/mcgoron.srfi.64.scm b/doc/mcgoron.srfi.64.scm
new file mode 100644
index 0000000..da0a8a4
--- /dev/null
+++ b/doc/mcgoron.srfi.64.scm
@@ -0,0 +1,71 @@
+(((name . "set-displayable!")
+ (signature
+ case-lambda
+ (((procedure? predicate?) (procedure? transformer)) *)
+ (((test-runner? runner) (procedure? predicate?) (procedure? transformer)) *))
+ (subsigs
+ (predicate? (lambda (*) boolean?))
+ (transformer (lambda ((test-runner? runner) (predicate? value)) *)))
+ (desc "
+Adds a new display transformer to the test runner. If no test runner is
+specified, adds a new display transformer to the current test runner.
+
+For information about how the test runner transforms values, see the
+documentation for `make-displayable`.
+
+The use of this function in conjunction with `make-displayable` makes it
+possible to rewrite recursive structures. For example, to translate a
+custom record type for the current test runner:
+
+ (define-record-type <my-record-type>
+ (my-record-type field1 field2)
+ my-record-type?
+ (field1 get-field1)
+ (field2 get-field2))
+
+ (set-displayable! my-record-type?
+ (lambda (runner value)
+ (list '<my-record-type>
+ (make-displayable runner (get-field1 value))
+ (make-displayable runner (get-field2 value)))))
+"))
+ ((name . "make-displayable")
+ (signature lambda ((test-runner? runner) value) *)
+ (desc "
+Attempts to make `value` displayable using the display transformers in
+`runner`.
+
+Whenever test results are written to the screen, the list of display
+transformers for that test runner are used to rewrite the test results to
+be writeable using `write`. This is used to make normally unprintable
+values such as `define-record-type` records printable.
+
+Whenever `make-displayable` is called with a value,
+the `predicate?` of each transformer in `runner` is checked, newest first,
+and if any of the `predicate?` procedures return true, the `transformer`
+procedure is called with the runner as the first argument and the value
+as the second argument.
+"))
+ ((name . "dynamic-property-set!")
+ (signature
+ case-lambda
+ ((property value) *)
+ (((test-runner? runner) property value) *))
+ (desc "
+Add `(cons property value)` to the dynamic property alist of runner. The
+dynamic properties of the runner are printed out at the end of a run and
+are discarded after the end of a test."))
+ ((name . "set-verbosity!")
+ (signature
+ case-lambda
+ ((value) *)
+ (((test-runner? runner) value *)))
+ (desc "
+Set verbosity of the runner.
+
+If `value` is `fails`, then only report failures. Otherwise report failures
+and successes."))
+ ((name . "factory")
+ (signature lambda () test-runner?)
+ (desc "
+An SRFI-64 factory, suitable for passing to `test-runner-factory`."))) \ No newline at end of file