简体   繁体   中英

Is there any usage of `test_ctxt` in oUnit

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?

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM