# Additional noteworthy information when a test success.
var info: nullable String = null
+ # Time for the execution, in seconds
+ var real_time: Float = 0.0 is writable
+
# A colorful `[OK]` or `[KO]`.
fun status_tag(color: nullable Bool): String do
color = color or else true
var tc = new HTMLTag("testcase")
tc.attr("classname", xml_classname)
tc.attr("name", xml_name)
+ tc.attr("time", real_time.to_s)
var error = self.error
if error != null then
if was_exec then
import testing_base
import markdown
import html
+import realtime
# Extractor, Executor and Reporter for the tests in a module
class NitUnitExecutor
var file = du.test_file.as(not null)
var i = du.test_arg.as(not null)
toolcontext.info("Execute doc-unit {du.full_name} in {file} {i}", 1)
+ var clock = new Clock
var res2 = toolcontext.safe_exec("{file.to_program_name}.bin {i} >'{file}.out1' 2>&1 </dev/null")
+ du.real_time = clock.total
du.was_exec = true
var content = "{file}.out1".to_path.read_all
var res = compile_unitfile(file)
var res2 = 0
if res == 0 then
+ var clock = new Clock
res2 = toolcontext.safe_exec("{file.to_program_name}.bin >'{file}.out1' 2>&1 </dev/null")
+ du.real_time = clock.total
du.was_exec = true
end
import testing_base
import html
private import annotation
+private import realtime
redef class ToolContext
# --pattern
var method_name = test_method.name
var test_file = test_suite.test_file
var res_name = "{test_file}_{method_name.escape_to_c}"
+ var clock = new Clock
var res = toolcontext.safe_exec("{test_file}.bin {method_name} > '{res_name}.out1' 2>&1 </dev/null")
+ real_time = clock.total
+
var raw_output = "{res_name}.out1".to_path.read_all
self.raw_output = raw_output
# set test case result