var dir = file.dirname
if dir != "" then dir.mkdir
var f
- f = new OFStream.open(file)
+ f = new FileWriter.open(file)
f.write("# GENERATED FILE\n")
f.write("# Docunits extracted from comments\n")
f.write("import {mmodule.name}\n")
f.write("end\n")
end
f.write("var a = args.first.to_i\n")
- for j in [1..i[ do
+ for j in [1..i] do
f.write("if a == {j} then run_{j}\n")
end
f.close
var res2 = sys.system("{file.to_program_name}.bin {i} >>'{file}.out1' 2>&1 </dev/null")
var msg
- f = new IFStream.open("{file}.out1")
+ f = new FileReader.open("{file}.out1")
var n2
n2 = new HTMLTag("system-err")
tc.add n2
var dir = file.dirname
if dir != "" then dir.mkdir
var f
- f = new OFStream.open(file)
+ f = new FileWriter.open(file)
f.write("# GENERATED FILE\n")
f.write("# Example extracted from a documentation\n")
f.write("import {mmodule.name}\n")
end
var msg
- f = new IFStream.open("{file}.out1")
+ f = new FileReader.open("{file}.out1")
var n2
n2 = new HTMLTag("system-err")
tc.add n2
var block: String
end
-class SearchAssertVisitor
- super Visitor
- var foundit = false
- redef fun visit(node)
- do
- if foundit then
- return
- else if node isa AAssertExpr then
- foundit = true
- return
- else
- node.visit_all(self)
- end
- end
-end
-
redef class ModelBuilder
+ # Total number analyzed `MEntity`
var total_entities = 0
+
+ # The number of `MEntity` that have some documentation
var doc_entities = 0
+
+ # The total number of executed docunits
var unit_entities = 0
+
+ # The number failed docunits
var failed_entities = 0
+ # Extracts and executes all the docunits in the `mmodule`
+ # Returns a JUnit-compatible `<testsuite>` XML element that contains the results of the executions.
fun test_markdown(mmodule: MModule): HTMLTag
do
var ts = new HTMLTag("testsuite")
toolcontext.info("nitunit: doc-unit {mmodule}", 2)
- if not mmodule2nmodule.has_key(mmodule) then return ts
- var nmodule = mmodule2nmodule[mmodule]
+ var nmodule = mmodule2node(mmodule)
+ if nmodule == null then return ts
# usualy, only the original module must be imported in the unit test.
var o = mmodule