Execute all the docunits

Property definitions

nitc $ NitUnitExecutor :: run_tests
	# Execute all the docunits
	fun run_tests
	do
		if docunits.is_empty then
			return
		end

		# Try to group each nitunit into a single source file to fasten the compilation
		var simple_du = new Array[DocUnit] # du that are simple statements
		var single_du = new Array[DocUnit] # du that are modules or include classes
		show_status
		for du in docunits do
			# Skip existing errors
			if du.error != null then
				continue
			end

			var ast = toolcontext.parse_something(du.block)
			if ast isa AExpr then
				simple_du.add du
			else
				single_du.add du
			end
		end

		# Try to mass compile all the simple du as a single nit module
		compile_simple_docunits(simple_du)
		# Try to mass compile all the single du in a single nitc invocation with many modules
		compile_single_docunits(single_du)
		# If the mass compilation fail, then each one will be compiled individually

		# Now test them in order
		for du in docunits do
			if du.error != null then
				# Nothing to execute. Conclude
			else if du.is_compiled then
				# Already compiled. Execute it.
				execute_simple_docunit(du)
			else
				# A mass compilation failed
				# Need to try to recompile it, then execute it
				test_single_docunit(du)
			end
			mark_done(du)
		end

		# Final status
		show_status
		print ""

		for du in docunits do
			testsuite.add du.to_xml
		end
	end
src/testing/testing_doc.nit:95,2--148,4