Is there any usage of `test_ctxt` in oUnit

258 Views Asked by At

I'm playing around with oUnit2 and I'm wondering: is there any usage for the test_ctxt parameter, as here:

let test1 test_ctxt = assert_equal "x" (Foo.unity "x");;

Is seems superfluous to me. Is there any way to omit it while defining tests as variables?

1

There are 1 best solutions below

2
On

A value of type test_ctxt is accepted as an optional parameter in assert_command and assert_equal functions, that are main basic blocks for building tests. The test context contains, in particular, a references to loggers, that allows to run tests in parallel. Using your example a correct invocation would be:

 let test1 ctxt = assert_equal ~ctxt "x" (Foo.unit "x)