A new block is started by non-trivial modules
Signed-off-by: Jean Privat <jean@pryen.org>
end
# All blocks of code from a same `ADoc`
end
# All blocks of code from a same `ADoc`
- var block = new Array[String]
+ var blocks = new Array[Array[String]]
redef fun process_code(n: HTMLTag, text: String)
do
redef fun process_code(n: HTMLTag, text: String)
do
v.enter_visit(ast)
if not v.foundit then return
v.enter_visit(ast)
if not v.foundit then return
+ # Create a first block
+ # Or create a new block for modules that are more than a main part
+ if blocks.is_empty or ast isa AModule then
+ blocks.add(new Array[String])
+ end
+
end
# used to generate distinct names
end
# used to generate distinct names
# Fill the prepated `tc` (testcase) XTM node
fun extract(ndoc: ADoc, tc: HTMLTag)
do
# Fill the prepated `tc` (testcase) XTM node
fun extract(ndoc: ADoc, tc: HTMLTag)
do
- if block.is_empty then return
+ if blocks.is_empty then return
+ for block in blocks do test_block(ndoc, tc, block)
+ end
+
+ # Execute a block
+ fun test_block(ndoc: ADoc, tc: HTMLTag, block: Array[String])
+ do
toolcontext.modelbuilder.unit_entities += 1
cpt += 1
toolcontext.modelbuilder.unit_entities += 1
cpt += 1