ref: a314850e53a81633fe82db56ddb4960e3b32e040
dir: /doc/api/libtestr/index.txt/
{ 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.