X-Git-Url: http://nitlanguage.org diff --git a/lib/markdown/test_markdown.nit b/lib/markdown/test_markdown.nit index 6dba442..e552883 100644 --- a/lib/markdown/test_markdown.nit +++ b/lib/markdown/test_markdown.nit @@ -93,7 +93,10 @@ This is a H1 This is a H2 ------------- """ - var exp = "

This is a H1

\n

This is a H2

\n" + var exp = """ +

This is a H1

+

This is a H2

+""" var res = test.md_to_html.write_to_string assert res == exp end @@ -105,7 +108,11 @@ This is a H2 ## This is a H2 ###### This is a H6 """ - var exp = "

This is a H1

\n

This is a H2

\n
This is a H6
\n" + var exp = """ +

This is a H1

+

This is a H2

+
This is a H6
+""" var res = test.md_to_html.write_to_string assert res == exp end @@ -118,7 +125,11 @@ This is a H2 ### This is a H3 ###### """ - var exp = "

This is a H1

\n

This is a H2

\n

This is a H3

\n" + var exp = """ +

This is a H1

+

This is a H2

+

This is a H3

+""" var res = test.md_to_html.write_to_string assert res == exp end @@ -396,6 +407,36 @@ sit amet, consectetuer adipiscing elit.

assert res == exp end + fun test_process_list11 do + var test = """ +This is a paragraph +* and this is not a list +""" + var exp = """ +

This is a paragraph +* and this is not a list

+""" + var proc = new MarkdownProcessor + proc.ext_mode = false + var res = proc.process(test).write_to_string + assert res == exp + end + + fun test_process_list_ext do + var test = """ +This is a paragraph +* and this is not a list +""" + var exp = """ +

This is a paragraph

+ +""" + var res = test.md_to_html.write_to_string + assert res == exp + end + fun test_process_code1 do var test = """ This is a normal paragraph: @@ -437,6 +478,106 @@ end tell assert res == exp end + fun test_process_code_ext1 do + var test = """ +Here is an example of AppleScript: +~~~ +tell application "Foo" + beep +end tell + + +~~~ +""" + var exp = """ +

Here is an example of AppleScript:

+
tell application "Foo"
+    beep
+end tell
+
+<div class="footer">
+    &copy; 2004 Foo Corporation
+</div>
+
+""" + var res = test.md_to_html.write_to_string + assert res == exp + end + + fun test_process_code_ext2 do + var test = """ +Here is an example of AppleScript: +``` +tell application "Foo" + beep +end tell + + +``` +""" + var exp = """ +

Here is an example of AppleScript:

+
tell application "Foo"
+    beep
+end tell
+
+<div class="footer">
+    &copy; 2004 Foo Corporation
+</div>
+
+""" + var res = test.md_to_html.write_to_string + assert res == exp + end + + fun test_process_code_ext3 do + var proc = new MarkdownProcessor + proc.ext_mode = false + + var test = """ +Here is an example of AppleScript: + beep +""" + var exp = """ +

Here is an example of AppleScript: +beep

+""" + var res = proc.process(test).write_to_string + assert res == exp + end + + fun test_process_code_ext4 do + var test = """ +Here is an example of AppleScript: + beep +""" + var exp = """ +

Here is an example of AppleScript:

+
beep
+
+""" + var res = test.md_to_html.write_to_string + assert res == exp + end + + fun test_process_code_ext5 do + var test = """ +```nit +print "Hello World!" +``` +""" + var exp = """ +
print "Hello World!"
+
+""" + var res = test.md_to_html.write_to_string + assert res == exp + end + fun test_process_nesting1 do var test = """ > ## This is a header. @@ -450,7 +591,7 @@ end tell """ var exp = """
-

This is a header.

+

This is a header.

  1. This is the first list item.
  2. This is the second list item.
  3. @@ -573,6 +714,22 @@ __double underscores__ assert res == exp end + fun test_process_emph3 do + var proc = new MarkdownProcessor + proc.ext_mode = false + var test = "Con_cat_this" + var exp = "

    Concatthis

    \n" + var res = proc.process(test).write_to_string + assert res == exp + end + + fun test_process_emph_ext do + var test = "Con_cat_this" + var exp = "

    Con_cat_this

    \n" + var res = test.md_to_html.write_to_string + assert res == exp + end + fun test_process_xml1 do var test = """ This is a regular paragraph. @@ -840,6 +997,29 @@ break with a line-ending space.

    assert res == exp end + fun test_process_strike do + var proc = new MarkdownProcessor + proc.ext_mode = false + var test = "This is how you ~~strike text~~" + var exp = "

    This is how you ~~strike text~~

    \n" + var res = proc.process(test).write_to_string + assert exp == res + end + + fun test_process_strike_ext do + var test = "This is how you ~~strike text~~" + var exp = "

    This is how you strike text

    \n" + var res = test.md_to_html.write_to_string + assert exp == res + end + + fun test_escape_bad_html do + var test = "-1 if < , +1 if > and 0 otherwise" + var exp = "

    -1 if < , +1 if > and 0 otherwise

    \n" + var res = test.md_to_html.write_to_string + assert exp == res + end + fun test_daring_encoding do var test = """ AT&T has an ampersand in their name. @@ -1207,6 +1387,9 @@ Here's how you put `` `backticks` `` in a code span. end fun test_daring_pars do + var proc = new MarkdownProcessor + proc.ext_mode = false + var test = """ In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. @@ -1227,7 +1410,7 @@ list item.

    Here's one with a bullet. * criminey.

    """ - var res = test.md_to_html.write_to_string + var res = proc.process(test).write_to_string assert res == exp end @@ -1951,7 +2134,7 @@ Same thing but with paragraphs: """ var exp = """ -

    Unordered

    +

    Unordered

    Asterisks tight:

    -

    Ordered

    +

    Ordered

    Tight:

    1. First
    2. @@ -2041,7 +2224,7 @@ back.

    3. Item 3.

    -

    Nested

    +

    Nested