lib/core/stream: LineIterator use CachedIterator
[nit.git] / lib / markdown2 / tests / test_markdown.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Test suites for module `markdown`
16 module test_markdown
17
18 import markdown_html_rendering
19
20 # Abstract test class that instanciates the markdown parser
21 abstract class TestMarkdown
22
23 # Markdown parser to use in tests
24 var md_parser = new MdParser
25
26 # Parse a `md` string as a MdNode
27 fun parse_md(md: String): MdNode do return md_parser.parse(md)
28 end
29
30 # Abstract test class that defines the test methods for HTML rendering
31 abstract class TestMarkdownHtml
32 super TestMarkdown
33
34 # HTML renderer used in tests
35 var html_renderer = new HtmlRenderer
36
37 # Render the `md` string as HTML
38 fun md_to_html(md: String): String do
39 var node = parse_md(md)
40 return html_renderer.render(node)
41 end
42 end