X-Git-Url: http://nitlanguage.org diff --git a/src/testing/testing_doc.nit b/src/testing/testing_doc.nit index cfaa912..7419c9f 100644 --- a/src/testing/testing_doc.nit +++ b/src/testing/testing_doc.nit @@ -36,8 +36,8 @@ class NitUnitExecutor # The XML node associated to the module var testsuite: HTMLTag - # All failures from a same `ADoc` - var failures = new Array[String] + # The name of the suite + var name: String # Markdown processor used to parse markdown comments and extract code. var mdproc = new MarkdownProcessor @@ -66,7 +66,6 @@ class NitUnitExecutor fun extract(mdoc: MDoc, xml_classname, xml_name: String) do last_docunit = null - failures.clear self.xml_classname = xml_classname self.xml_name = xml_name @@ -74,29 +73,27 @@ class NitUnitExecutor # Populate `blocks` from the markdown decorator mdproc.process(mdoc.content.join("\n")) - - toolcontext.check_errors - - if not failures.is_empty then - for msg in failures do - var ne = new HTMLTag("failure") - ne.attr("message", msg) - tc.add ne - toolcontext.modelbuilder.unit_entities += 1 - toolcontext.modelbuilder.failed_entities += 1 - end - if last_docunit == null then testsuite.add(tc) - end end # All extracted docunits var docunits = new Array[DocUnit] + fun mark_done(du: DocUnit) + do + du.is_done = true + end + # Execute all the docunits fun run_tests do var simple_du = new Array[DocUnit] for du in docunits do + # Skip existing errors + if du.error != null then + mark_done(du) + continue + end + var ast = toolcontext.parse_something(du.block) if ast isa AExpr then simple_du.add du @@ -108,6 +105,10 @@ class NitUnitExecutor test_simple_docunits(simple_du) for du in docunits do + print du.to_screen + end + + for du in docunits do testsuite.add du.to_xml end end @@ -161,16 +162,16 @@ class NitUnitExecutor i += 1 toolcontext.info("Execute doc-unit {du.full_name} in {file} {i}", 1) var res2 = toolcontext.safe_exec("{file.to_program_name}.bin {i} >'{file}.out1' 2>&1 '{file}.out1' 2>&1