summaryrefslogtreecommitdiff
path: root/src/test/kotlin/moe/nea/blog/gen/HtmlTest.kt
blob: 439fbebb4fc1f06b904dee48a6214598aa5558c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package moe.nea.blog.gen

import moe.nea.blog.md.Bold
import moe.nea.blog.md.FormatSequence
import moe.nea.blog.md.Paragraph
import moe.nea.blog.md.Whitespace
import moe.nea.blog.md.Word
import kotlin.test.Test

class HtmlTest : HtmlGenerationTest() {

	@Test
	fun testBiggerFile() {
		assertGeneratorMD(
			"""
			|<h1>Hello World</h1><p></p><p><b><em>lol</em> hehe</b></p><pre><code class="language-java">public class ObjectControllerFactoryManagerProvider&lt;T extends ObjectControllerFactoryManager&lt;T&gt;&gt; {
			|   public ObjectControllerFactoryManagerProvider() {}
			|}</code></pre>
			""".trimMargin(),
			"""
			|# Hello World
			|
			|***lol*  hehe**
			|
			|```java
			|public class ObjectControllerFactoryManagerProvider<T extends ObjectControllerFactoryManager<T>> {
			|   public ObjectControllerFactoryManagerProvider() {}
			|}
			|```
			""".trimMargin()
		)
	}

	@Test
	fun testBold() {
		assertGenerator("<b>Hii</b>", Bold(Word("Hii")))
	}

	@Test
	fun testParagraphs() {
		assertGenerator(
			"<p>Test <b>Whatever</b></p>",
			Paragraph(FormatSequence(Word("Test"), Whitespace(), Bold(Word("Whatever"))))
		)
	}

}