ci: tests for macOS on Gitlab CI
[nit.git] / lib / markdown2 / tests / test_commonmark_atx_headings.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 module test_commonmark_atx_headings is test
16
17 import test_markdown
18
19 class TestCommonmarkATXHeadings
20 super TestMarkdownHtml
21 test
22
23 fun test32 is test do
24 var md = """# foo\n## foo\n### foo\n#### foo\n##### foo\n###### foo\n"""
25 var html = """<h1>foo</h1>\n<h2>foo</h2>\n<h3>foo</h3>\n<h4>foo</h4>\n<h5>foo</h5>\n<h6>foo</h6>\n"""
26 assert md_to_html(md) == html
27 end
28
29 fun test33 is test do
30 var md = """####### foo\n"""
31 var html = """<p>####### foo</p>\n"""
32 assert md_to_html(md) == html
33 end
34
35 fun test34 is test do
36 var md = """#5 bolt\n\n#hashtag\n"""
37 var html = """<p>#5 bolt</p>\n<p>#hashtag</p>\n"""
38 assert md_to_html(md) == html
39 end
40
41 fun test35 is test do
42 var md = """\\## foo\n"""
43 var html = """<p>## foo</p>\n"""
44 assert md_to_html(md) == html
45 end
46
47 fun test36 is test do
48 var md = """# foo *bar* \\*baz\\*\n"""
49 var html = """<h1>foo <em>bar</em> *baz*</h1>\n"""
50 assert md_to_html(md) == html
51 end
52
53 fun test37 is test do
54 var md = """# foo \n"""
55 var html = """<h1>foo</h1>\n"""
56 assert md_to_html(md) == html
57 end
58
59 fun test38 is test do
60 var md = """ ### foo\n ## foo\n # foo\n"""
61 var html = """<h3>foo</h3>\n<h2>foo</h2>\n<h1>foo</h1>\n"""
62 assert md_to_html(md) == html
63 end
64
65 fun test39 is test do
66 var md = """ # foo\n"""
67 var html = """<pre><code># foo\n</code></pre>\n"""
68 assert md_to_html(md) == html
69 end
70
71 fun test40 is test do
72 var md = """foo\n # bar\n"""
73 var html = """<p>foo\n# bar</p>\n"""
74 assert md_to_html(md) == html
75 end
76
77 fun test41 is test do
78 var md = """## foo ##\n ### bar ###\n"""
79 var html = """<h2>foo</h2>\n<h3>bar</h3>\n"""
80 assert md_to_html(md) == html
81 end
82
83 fun test42 is test do
84 var md = """# foo ##################################\n##### foo ##\n"""
85 var html = """<h1>foo</h1>\n<h5>foo</h5>\n"""
86 assert md_to_html(md) == html
87 end
88
89 fun test43 is test do
90 var md = """### foo ### \n"""
91 var html = """<h3>foo</h3>\n"""
92 assert md_to_html(md) == html
93 end
94
95 fun test44 is test do
96 var md = """### foo ### b\n"""
97 var html = """<h3>foo ### b</h3>\n"""
98 assert md_to_html(md) == html
99 end
100
101 fun test45 is test do
102 var md = """# foo#\n"""
103 var html = """<h1>foo#</h1>\n"""
104 assert md_to_html(md) == html
105 end
106
107 fun test46 is test do
108 var md = """### foo \\###\n## foo #\\##\n# foo \\#\n"""
109 var html = """<h3>foo ###</h3>\n<h2>foo ###</h2>\n<h1>foo #</h1>\n"""
110 assert md_to_html(md) == html
111 end
112
113 fun test47 is test do
114 var md = """****\n## foo\n****\n"""
115 var html = """<hr />\n<h2>foo</h2>\n<hr />\n"""
116 assert md_to_html(md) == html
117 end
118
119 fun test48 is test do
120 var md = """Foo bar\n# baz\nBar foo\n"""
121 var html = """<p>Foo bar</p>\n<h1>baz</h1>\n<p>Bar foo</p>\n"""
122 assert md_to_html(md) == html
123 end
124
125 fun test49 is test do
126 var md = """## \n#\n### ###\n"""
127 var html = """<h2></h2>\n<h1></h1>\n<h3></h3>\n"""
128 assert md_to_html(md) == html
129 end
130 end