Merge: src/model/model_index: model index uses BKTree
[nit.git] / lib / markdown2 / tests / test_commonmark_fenced_code_blocks.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_fenced_code_blocks is test
16
17 import test_markdown
18
19 class TestCommonmarkFencedCodeBlocks
20 super TestMarkdownHtml
21 test
22
23 fun test88 is test do
24 var md = """```\n<\n >\n```\n"""
25 var html = """<pre><code>&lt;\n &gt;\n</code></pre>\n"""
26 assert md_to_html(md) == html
27 end
28
29 fun test89 is test do
30 var md = """~~~\n<\n >\n~~~\n"""
31 var html = """<pre><code>&lt;\n &gt;\n</code></pre>\n"""
32 assert md_to_html(md) == html
33 end
34
35 fun test90 is test do
36 var md = """``\nfoo\n``\n"""
37 var html = """<p><code>foo</code></p>\n"""
38 assert md_to_html(md) == html
39 end
40
41 fun test91 is test do
42 var md = """```\naaa\n~~~\n```\n"""
43 var html = """<pre><code>aaa\n~~~\n</code></pre>\n"""
44 assert md_to_html(md) == html
45 end
46
47 fun test92 is test do
48 var md = """~~~\naaa\n```\n~~~\n"""
49 var html = """<pre><code>aaa\n```\n</code></pre>\n"""
50 assert md_to_html(md) == html
51 end
52
53 fun test93 is test do
54 var md = """````\naaa\n```\n``````\n"""
55 var html = """<pre><code>aaa\n```\n</code></pre>\n"""
56 assert md_to_html(md) == html
57 end
58
59 fun test94 is test do
60 var md = """~~~~\naaa\n~~~\n~~~~\n"""
61 var html = """<pre><code>aaa\n~~~\n</code></pre>\n"""
62 assert md_to_html(md) == html
63 end
64
65 fun test95 is test do
66 var md = """```\n"""
67 var html = """<pre><code></code></pre>\n"""
68 assert md_to_html(md) == html
69 end
70
71 fun test96 is test do
72 var md = """`````\n\n```\naaa\n"""
73 var html = """<pre><code>\n```\naaa\n</code></pre>\n"""
74 assert md_to_html(md) == html
75 end
76
77 fun test97 is test do
78 var md = """> ```\n> aaa\n\nbbb\n"""
79 var html = """<blockquote>\n<pre><code>aaa\n</code></pre>\n</blockquote>\n<p>bbb</p>\n"""
80 assert md_to_html(md) == html
81 end
82
83 fun test98 is test do
84 var md = """```\n\n \n```\n"""
85 var html = """<pre><code>\n \n</code></pre>\n"""
86 assert md_to_html(md) == html
87 end
88
89 fun test99 is test do
90 var md = """```\n```\n"""
91 var html = """<pre><code></code></pre>\n"""
92 assert md_to_html(md) == html
93 end
94
95 fun test100 is test do
96 var md = """ ```\n aaa\naaa\n```\n"""
97 var html = """<pre><code>aaa\naaa\n</code></pre>\n"""
98 assert md_to_html(md) == html
99 end
100
101 fun test101 is test do
102 var md = """ ```\naaa\n aaa\naaa\n ```\n"""
103 var html = """<pre><code>aaa\naaa\naaa\n</code></pre>\n"""
104 assert md_to_html(md) == html
105 end
106
107 fun test102 is test do
108 var md = """ ```\n aaa\n aaa\n aaa\n ```\n"""
109 var html = """<pre><code>aaa\n aaa\naaa\n</code></pre>\n"""
110 assert md_to_html(md) == html
111 end
112
113 fun test103 is test do
114 var md = """ ```\n aaa\n ```\n"""
115 var html = """<pre><code>```\naaa\n```\n</code></pre>\n"""
116 assert md_to_html(md) == html
117 end
118
119 fun test104 is test do
120 var md = """```\naaa\n ```\n"""
121 var html = """<pre><code>aaa\n</code></pre>\n"""
122 assert md_to_html(md) == html
123 end
124
125 fun test105 is test do
126 var md = """ ```\naaa\n ```\n"""
127 var html = """<pre><code>aaa\n</code></pre>\n"""
128 assert md_to_html(md) == html
129 end
130
131 fun test106 is test do
132 var md = """```\naaa\n ```\n"""
133 var html = """<pre><code>aaa\n ```\n</code></pre>\n"""
134 assert md_to_html(md) == html
135 end
136
137 fun test107 is test do
138 var md = """``` ```\naaa\n"""
139 var html = """<p><code></code>\naaa</p>\n"""
140 assert md_to_html(md) == html
141 end
142
143 fun test108 is test do
144 var md = """~~~~~~\naaa\n~~~ ~~\n"""
145 var html = """<pre><code>aaa\n~~~ ~~\n</code></pre>\n"""
146 assert md_to_html(md) == html
147 end
148
149 fun test109 is test do
150 var md = """foo\n```\nbar\n```\nbaz\n"""
151 var html = """<p>foo</p>\n<pre><code>bar\n</code></pre>\n<p>baz</p>\n"""
152 assert md_to_html(md) == html
153 end
154
155 fun test110 is test do
156 var md = """foo\n---\n~~~\nbar\n~~~\n# baz\n"""
157 var html = """<h2>foo</h2>\n<pre><code>bar\n</code></pre>\n<h1>baz</h1>\n"""
158 assert md_to_html(md) == html
159 end
160
161 fun test111 is test do
162 var md = """```ruby\ndef foo(x)\n return 3\nend\n```\n"""
163 var html = """<pre><code class="language-ruby">def foo(x)\n return 3\nend\n</code></pre>\n"""
164 assert md_to_html(md) == html
165 end
166
167 fun test112 is test do
168 var md = """~~~~ ruby startline=3 $%@#$\ndef foo(x)\n return 3\nend\n~~~~~~~\n"""
169 var html = """<pre><code class="language-ruby">def foo(x)\n return 3\nend\n</code></pre>\n"""
170 assert md_to_html(md) == html
171 end
172
173 fun test113 is test do
174 var md = """````;\n````\n"""
175 var html = """<pre><code class="language-;"></code></pre>\n"""
176 assert md_to_html(md) == html
177 end
178
179 fun test114 is test do
180 var md = """``` aa ```\nfoo\n"""
181 var html = """<p><code>aa</code>\nfoo</p>\n"""
182 assert md_to_html(md) == html
183 end
184
185 fun test115 is test do
186 var md = """```\n``` aaa\n```\n"""
187 var html = """<pre><code>``` aaa\n</code></pre>\n"""
188 assert md_to_html(md) == html
189 end
190 end