summaryrefslogtreecommitdiff
path: root/doc/api/libtestr/index.txt
diff options
context:
space:
mode:
Diffstat (limited to 'doc/api/libtestr/index.txt')
-rw-r--r--doc/api/libtestr/index.txt64
1 files changed, 64 insertions, 0 deletions
diff --git a/doc/api/libtestr/index.txt b/doc/api/libtestr/index.txt
new file mode 100644
index 0000000..774f364
--- /dev/null
+++ b/doc/api/libtestr/index.txt
@@ -0,0 +1,64 @@
+{
+ title: libtestr
+ description: Myrddin Test Library
+}
+
+Libtestr
+---------
+
+ pkg testr =
+ type ctx
+
+ type spec = struct
+ name : byte[:]
+ fn : (ctx : ctx# -> void)
+ ;;
+
+ const run : (specs : spec[:] -> void)
+ const ok : (ctx : ctx# -> void)
+ const fail : (ctx : ctx#, msg : byte[:] -> void)
+ ;;
+
+Overview
+--------
+
+The testr library provides a simple library for running
+unit tests. It outputs subtest results in a format that mbld
+will be able to understand, log, and report on.
+
+Types
+-----
+
+ type ctx
+
+The context for the current test. Used to record the state
+of the set of tests currently running.
+
+ type spec = struct
+ name : byte[:]
+ fn : (ctx : ctx# -> void)
+ ;;
+
+The specification for a single test. Contains the name
+of the test being run, and the code used to execute it.
+
+Mutex.
+
+Functions: Mutexes
+------------------
+
+ const run : (specs : spec[:] -> void)
+
+Runs a sequence of tests, recording the state of the test
+and outputting an appropriate log for mtest to consume.
+
+ const ok : (ctx : ctx# -> void)
+
+Records a test success. It does not leave the current
+scope.
+
+ const fail : (ctx : ctx#, msg : byte[:] -> void)
+
+Records a test failure. It does not leave the current
+scope.
+