X-Git-Url: http://nitlanguage.org diff --git a/src/testing/testing_doc.nit b/src/testing/testing_doc.nit index 82518da..6bd8f0b 100644 --- a/src/testing/testing_doc.nit +++ b/src/testing/testing_doc.nit @@ -290,11 +290,8 @@ private class NitunitDecorator var executor: NitUnitExecutor redef fun add_code(v, block) do - var code = code_from_block(block) - var meta = "nit" - if block isa BlockFence and block.meta != null then - meta = block.meta.to_s - end + var code = block.raw_content + var meta = block.meta or else "nit" # Do not try to test non-nit code. if meta != "nit" then return # Try to parse code blocks @@ -321,26 +318,6 @@ private class NitunitDecorator # Add it to the file executor.blocks.last.append code end - - # Extracts code as String from a `BlockCode`. - fun code_from_block(block: BlockCode): String do - var infence = block isa BlockFence - var text = new FlatBuffer - var line = block.block.first_line - while line != null do - if not line.is_empty then - var str = line.value - if not infence and str.has_prefix(" ") then - text.append str.substring(4, str.length - line.trailing) - else - text.append str - end - end - text.append "\n" - line = line.next - end - return text.write_to_string - end end # A unit-test to run